Skip to content

Commit d9ab878

Browse files
pks-tgitster
authored andcommitted
git-submodule.sh: break overly long command lines
For most of the subcommands of git-submodule(1), we end up passing a bunch of arguments to the submodule helper. This quickly leads to overly long lines, where it becomes hard to spot what has changed when one needs to modify them. Break up these lines into one argument per line, similarly to how it is done for the "clone" subcommand already. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 406f326 commit d9ab878

File tree

1 file changed

+55
-9
lines changed

1 file changed

+55
-9
lines changed

git-submodule.sh

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,17 @@ cmd_add()
129129
usage
130130
fi
131131

132-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add ${quiet:+--quiet} ${force:+--force} ${progress:+"--progress"} ${branch:+--branch "$branch"} ${reference_path:+--reference "$reference_path"} ${dissociate:+--dissociate} ${custom_name:+--name "$custom_name"} ${depth:+"$depth"} -- "$@"
132+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add \
133+
${quiet:+--quiet} \
134+
${force:+--force} \
135+
${progress:+"--progress"} \
136+
${branch:+--branch "$branch"} \
137+
${reference_path:+--reference "$reference_path"} \
138+
${dissociate:+--dissociate} \
139+
${custom_name:+--name "$custom_name"} \
140+
${depth:+"$depth"} \
141+
-- \
142+
"$@"
133143
}
134144

135145
#
@@ -160,7 +170,11 @@ cmd_foreach()
160170
shift
161171
done
162172

163-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
173+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach \
174+
${quiet:+--quiet} \
175+
${recursive:+--recursive} \
176+
-- \
177+
"$@"
164178
}
165179

166180
#
@@ -191,7 +205,10 @@ cmd_init()
191205
shift
192206
done
193207

194-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${quiet:+--quiet} -- "$@"
208+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init \
209+
${quiet:+--quiet} \
210+
-- \
211+
"$@"
195212
}
196213

197214
#
@@ -227,7 +244,12 @@ cmd_deinit()
227244
shift
228245
done
229246

230-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${quiet:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@"
247+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit \
248+
${quiet:+--quiet} \
249+
${force:+--force} \
250+
${deinit_all:+--all} \
251+
-- \
252+
"$@"
231253
}
232254

233255
#
@@ -399,7 +421,12 @@ cmd_set_branch() {
399421
shift
400422
done
401423

402-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${quiet:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@"
424+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch \
425+
${quiet:+--quiet} \
426+
${branch:+--branch "$branch"} \
427+
${default:+--default} \
428+
-- \
429+
"$@"
403430
}
404431

405432
#
@@ -428,7 +455,10 @@ cmd_set_url() {
428455
shift
429456
done
430457

431-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${quiet:+--quiet} -- "$@"
458+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url \
459+
${quiet:+--quiet} \
460+
-- \
461+
"$@"
432462
}
433463

434464
#
@@ -480,7 +510,13 @@ cmd_summary() {
480510
shift
481511
done
482512

483-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper summary ${files:+--files} ${cached:+--cached} ${for_status:+--for-status} ${summary_limit:+-n $summary_limit} -- "$@"
513+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper summary \
514+
${files:+--files} \
515+
${cached:+--cached} \
516+
${for_status:+--for-status} \
517+
${summary_limit:+-n $summary_limit} \
518+
-- \
519+
"$@"
484520
}
485521
#
486522
# List all submodules, prefixed with:
@@ -521,8 +557,14 @@ cmd_status()
521557
shift
522558
done
523559

524-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status ${quiet:+--quiet} ${cached:+--cached} ${recursive:+--recursive} -- "$@"
560+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status \
561+
${quiet:+--quiet} \
562+
${cached:+--cached} \
563+
${recursive:+--recursive} \
564+
-- \
565+
"$@"
525566
}
567+
526568
#
527569
# Sync remote urls for submodules
528570
# This makes the value for remote.$remote.url match the value
@@ -554,7 +596,11 @@ cmd_sync()
554596
esac
555597
done
556598

557-
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
599+
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync \
600+
${quiet:+--quiet} \
601+
${recursive:+--recursive} \
602+
-- \
603+
"$@"
558604
}
559605

560606
cmd_absorbgitdirs()

0 commit comments

Comments
 (0)