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 <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-08-08 09:35:27 +02:00 committed by Junio C Hamano
parent 406f326d27
commit d9ab8788e1

View file

@ -129,7 +129,17 @@ cmd_add()
usage usage
fi 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 shift
done 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 shift
done 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 shift
done 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 shift
done 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 shift
done 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 shift
done 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: # List all submodules, prefixed with:
@ -521,8 +557,14 @@ cmd_status()
shift shift
done 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 # Sync remote urls for submodules
# This makes the value for remote.$remote.url match the value # This makes the value for remote.$remote.url match the value
@ -554,7 +596,11 @@ cmd_sync()
esac esac
done 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() cmd_absorbgitdirs()