]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-submodule.sh: break overly long command lines
authorPatrick Steinhardt <ps@pks.im>
Thu, 8 Aug 2024 07:35:27 +0000 (09:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Aug 2024 16:20:48 +0000 (09:20 -0700)
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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-submodule.sh

index 7f9582d92343450e0c71ba72e5faee845cc1165b..fd588b1864b51cedf7cb8944bdf407495eefe0da 100755 (executable)
@@ -129,7 +129,17 @@ cmd_add()
                usage
        fi
 
-       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"} -- "$@"
+       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"} \
+               -- \
+               "$@"
 }
 
 #
@@ -160,7 +170,11 @@ cmd_foreach()
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach \
+               ${quiet:+--quiet} \
+               ${recursive:+--recursive} \
+               -- \
+               "$@"
 }
 
 #
@@ -191,7 +205,10 @@ cmd_init()
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${quiet:+--quiet} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init \
+               ${quiet:+--quiet} \
+               -- \
+               "$@"
 }
 
 #
@@ -227,7 +244,12 @@ cmd_deinit()
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${quiet:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit \
+               ${quiet:+--quiet} \
+               ${force:+--force} \
+               ${deinit_all:+--all} \
+               -- \
+               "$@"
 }
 
 #
@@ -399,7 +421,12 @@ cmd_set_branch() {
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${quiet:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch \
+               ${quiet:+--quiet} \
+               ${branch:+--branch "$branch"} \
+               ${default:+--default} \
+               -- \
+               "$@"
 }
 
 #
@@ -428,7 +455,10 @@ cmd_set_url() {
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${quiet:+--quiet} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url \
+               ${quiet:+--quiet} \
+               -- \
+               "$@"
 }
 
 #
@@ -480,7 +510,13 @@ cmd_summary() {
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper summary ${files:+--files} ${cached:+--cached} ${for_status:+--for-status} ${summary_limit:+-n $summary_limit} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper summary \
+               ${files:+--files} \
+               ${cached:+--cached} \
+               ${for_status:+--for-status} \
+               ${summary_limit:+-n $summary_limit} \
+               -- \
+               "$@"
 }
 #
 # List all submodules, prefixed with:
@@ -521,8 +557,14 @@ cmd_status()
                shift
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status ${quiet:+--quiet} ${cached:+--cached} ${recursive:+--recursive} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status \
+               ${quiet:+--quiet} \
+               ${cached:+--cached} \
+               ${recursive:+--recursive} \
+               -- \
+               "$@"
 }
+
 #
 # Sync remote urls for submodules
 # This makes the value for remote.$remote.url match the value
@@ -554,7 +596,11 @@ cmd_sync()
                esac
        done
 
-       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
+       git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync \
+               ${quiet:+--quiet} \
+               ${recursive:+--recursive} \
+               -- \
+               "$@"
 }
 
 cmd_absorbgitdirs()