Merge branch 'ab/submodule-cleanup' into gc/submodule-use-super-prefix
* ab/submodule-cleanup: git-sh-setup.sh: remove "say" function, change last users git-submodule.sh: use "$quiet", not "$GIT_QUIET" submodule--helper: eliminate internal "--update" option submodule--helper: understand --checkout, --merge and --rebase synonyms submodule--helper: report "submodule" as our name in some "-h" output submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" submodule update: remove "-v" option submodule--helper: have --require-init imply --init git-submodule.sh: remove unused top-level "--branch" argument git-submodule.sh: make the "$cached" variable a boolean git-submodule.sh: remove unused $prefix variable git-submodule.sh: remove unused sanitize_submodule_env()maint
commit
c9e221b124
|
@ -444,7 +444,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper foreach [--quiet] [--recursive] [--] <command>"),
|
N_("git submodule foreach [--quiet] [--recursive] [--] <command>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ static int module_init(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper init [<options>] [<path>]"),
|
N_("git submodule init [<options>] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1185,7 +1185,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper summary [<options>] [<commit>] [--] [<path>]"),
|
N_("git submodule summary [<options>] [<commit>] [--] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1349,7 +1349,7 @@ static int module_sync(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper sync [--quiet] [--recursive] [<path>]"),
|
N_("git submodule sync [--quiet] [--recursive] [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1818,7 +1818,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
||||||
static void determine_submodule_update_strategy(struct repository *r,
|
static void determine_submodule_update_strategy(struct repository *r,
|
||||||
int just_cloned,
|
int just_cloned,
|
||||||
const char *path,
|
const char *path,
|
||||||
const char *update,
|
enum submodule_update_type update,
|
||||||
struct submodule_update_strategy *out)
|
struct submodule_update_strategy *out)
|
||||||
{
|
{
|
||||||
const struct submodule *sub = submodule_from_path(r, null_oid(), path);
|
const struct submodule *sub = submodule_from_path(r, null_oid(), path);
|
||||||
|
@ -1828,9 +1828,7 @@ static void determine_submodule_update_strategy(struct repository *r,
|
||||||
key = xstrfmt("submodule.%s.update", sub->name);
|
key = xstrfmt("submodule.%s.update", sub->name);
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
if (parse_submodule_update_strategy(update, out) < 0)
|
out->type = update;
|
||||||
die(_("Invalid update mode '%s' for submodule path '%s'"),
|
|
||||||
update, path);
|
|
||||||
} else if (!repo_config_get_string_tmp(r, key, &val)) {
|
} else if (!repo_config_get_string_tmp(r, key, &val)) {
|
||||||
if (parse_submodule_update_strategy(val, out) < 0)
|
if (parse_submodule_update_strategy(val, out) < 0)
|
||||||
die(_("Invalid update mode '%s' configured for submodule path '%s'"),
|
die(_("Invalid update mode '%s' configured for submodule path '%s'"),
|
||||||
|
@ -1882,7 +1880,7 @@ struct update_data {
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
const char *recursive_prefix;
|
const char *recursive_prefix;
|
||||||
const char *displaypath;
|
const char *displaypath;
|
||||||
const char *update_default;
|
enum submodule_update_type update_default;
|
||||||
struct object_id suboid;
|
struct object_id suboid;
|
||||||
struct string_list references;
|
struct string_list references;
|
||||||
struct submodule_update_strategy update_strategy;
|
struct submodule_update_strategy update_strategy;
|
||||||
|
@ -2405,8 +2403,27 @@ static void ensure_core_worktree(const char *path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *submodule_update_type_to_label(enum submodule_update_type type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case SM_UPDATE_CHECKOUT:
|
||||||
|
return "checkout";
|
||||||
|
case SM_UPDATE_MERGE:
|
||||||
|
return "merge";
|
||||||
|
case SM_UPDATE_REBASE:
|
||||||
|
return "rebase";
|
||||||
|
case SM_UPDATE_UNSPECIFIED:
|
||||||
|
case SM_UPDATE_NONE:
|
||||||
|
case SM_UPDATE_COMMAND:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
BUG("unreachable with type %d", type);
|
||||||
|
}
|
||||||
|
|
||||||
static void update_data_to_args(struct update_data *update_data, struct strvec *args)
|
static void update_data_to_args(struct update_data *update_data, struct strvec *args)
|
||||||
{
|
{
|
||||||
|
enum submodule_update_type update_type = update_data->update_default;
|
||||||
|
|
||||||
strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
|
strvec_pushl(args, "submodule--helper", "update", "--recursive", NULL);
|
||||||
strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
|
strvec_pushf(args, "--jobs=%d", update_data->max_jobs);
|
||||||
if (update_data->recursive_prefix)
|
if (update_data->recursive_prefix)
|
||||||
|
@ -2430,8 +2447,10 @@ static void update_data_to_args(struct update_data *update_data, struct strvec *
|
||||||
strvec_push(args, "--require-init");
|
strvec_push(args, "--require-init");
|
||||||
if (update_data->depth)
|
if (update_data->depth)
|
||||||
strvec_pushf(args, "--depth=%d", update_data->depth);
|
strvec_pushf(args, "--depth=%d", update_data->depth);
|
||||||
if (update_data->update_default)
|
if (update_type != SM_UPDATE_UNSPECIFIED)
|
||||||
strvec_pushl(args, "--update", update_data->update_default, NULL);
|
strvec_pushf(args, "--%s",
|
||||||
|
submodule_update_type_to_label(update_type));
|
||||||
|
|
||||||
if (update_data->references.nr) {
|
if (update_data->references.nr) {
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
for_each_string_list_item(item, &update_data->references)
|
for_each_string_list_item(item, &update_data->references)
|
||||||
|
@ -2601,9 +2620,15 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
||||||
N_("path"),
|
N_("path"),
|
||||||
N_("path into the working tree, across nested "
|
N_("path into the working tree, across nested "
|
||||||
"submodule boundaries")),
|
"submodule boundaries")),
|
||||||
OPT_STRING(0, "update", &opt.update_default,
|
OPT_SET_INT(0, "checkout", &opt.update_default,
|
||||||
N_("string"),
|
N_("use the 'checkout' update strategy (default)"),
|
||||||
N_("rebase, merge, checkout or none")),
|
SM_UPDATE_CHECKOUT),
|
||||||
|
OPT_SET_INT('m', "merge", &opt.update_default,
|
||||||
|
N_("use the 'merge' update strategy"),
|
||||||
|
SM_UPDATE_MERGE),
|
||||||
|
OPT_SET_INT('r', "rebase", &opt.update_default,
|
||||||
|
N_("use the 'rebase' update strategy"),
|
||||||
|
SM_UPDATE_REBASE),
|
||||||
OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
|
OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
|
||||||
N_("reference repository")),
|
N_("reference repository")),
|
||||||
OPT_BOOL(0, "dissociate", &opt.dissociate,
|
OPT_BOOL(0, "dissociate", &opt.dissociate,
|
||||||
|
@ -2619,7 +2644,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
||||||
OPT_BOOL(0, "progress", &opt.progress,
|
OPT_BOOL(0, "progress", &opt.progress,
|
||||||
N_("force cloning progress")),
|
N_("force cloning progress")),
|
||||||
OPT_BOOL(0, "require-init", &opt.require_init,
|
OPT_BOOL(0, "require-init", &opt.require_init,
|
||||||
N_("disallow cloning into non-empty directory")),
|
N_("disallow cloning into non-empty directory, implies --init")),
|
||||||
OPT_BOOL(0, "single-branch", &opt.single_branch,
|
OPT_BOOL(0, "single-branch", &opt.single_branch,
|
||||||
N_("clone only one branch, HEAD or --branch")),
|
N_("clone only one branch, HEAD or --branch")),
|
||||||
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
|
||||||
|
@ -2643,6 +2668,9 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
||||||
argc = parse_options(argc, argv, prefix, module_update_options,
|
argc = parse_options(argc, argv, prefix, module_update_options,
|
||||||
git_submodule_helper_usage, 0);
|
git_submodule_helper_usage, 0);
|
||||||
|
|
||||||
|
if (opt.require_init)
|
||||||
|
opt.init = 1;
|
||||||
|
|
||||||
if (filter_options.choice && !opt.init) {
|
if (filter_options.choice && !opt.init) {
|
||||||
usage_with_options(git_submodule_helper_usage,
|
usage_with_options(git_submodule_helper_usage,
|
||||||
module_update_options);
|
module_update_options);
|
||||||
|
@ -2651,9 +2679,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
|
||||||
opt.filter_options = &filter_options;
|
opt.filter_options = &filter_options;
|
||||||
|
|
||||||
if (opt.update_default)
|
if (opt.update_default)
|
||||||
if (parse_submodule_update_strategy(opt.update_default,
|
opt.update_strategy.type = opt.update_default;
|
||||||
&opt.update_strategy) < 0)
|
|
||||||
die(_("bad value for update parameter"));
|
|
||||||
|
|
||||||
if (module_list_compute(argc, argv, prefix, &pathspec, &opt.list) < 0) {
|
if (module_list_compute(argc, argv, prefix, &pathspec, &opt.list) < 0) {
|
||||||
list_objects_filter_release(&filter_options);
|
list_objects_filter_release(&filter_options);
|
||||||
|
@ -2785,7 +2811,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const git_submodule_helper_usage[] = {
|
const char *const git_submodule_helper_usage[] = {
|
||||||
N_("git submodule--helper absorb-git-dirs [<options>] [<path>...]"),
|
N_("git submodule absorbgitdirs [<options>] [<path>...]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2890,7 +2916,7 @@ static int module_set_url(int argc, const char **argv, const char *prefix)
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
const char *const usage[] = {
|
const char *const usage[] = {
|
||||||
N_("git submodule--helper set-url [--quiet] <path> <newurl>"),
|
N_("git submodule set-url [--quiet] <path> <newurl>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2929,8 +2955,8 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
const char *const usage[] = {
|
const char *const usage[] = {
|
||||||
N_("git submodule--helper set-branch [-q|--quiet] (-d|--default) <path>"),
|
N_("git submodule set-branch [-q|--quiet] (-d|--default) <path>"),
|
||||||
N_("git submodule--helper set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
|
N_("git submodule set-branch [-q|--quiet] (-b|--branch) <branch> <path>"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3274,7 +3300,7 @@ static int module_add(int argc, const char **argv, const char *prefix)
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *const usage[] = {
|
const char *const usage[] = {
|
||||||
N_("git submodule--helper add [<options>] [--] <repository> [<path>]"),
|
N_("git submodule add [<options>] [--] <repository> [<path>]"),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3387,7 +3413,7 @@ static struct cmd_struct commands[] = {
|
||||||
{"deinit", module_deinit, 0},
|
{"deinit", module_deinit, 0},
|
||||||
{"summary", module_summary, SUPPORT_SUPER_PREFIX},
|
{"summary", module_summary, SUPPORT_SUPER_PREFIX},
|
||||||
{"push-check", push_check, 0},
|
{"push-check", push_check, 0},
|
||||||
{"absorb-git-dirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX},
|
{"absorbgitdirs", absorb_git_dirs, SUPPORT_SUPER_PREFIX},
|
||||||
{"is-active", is_active, 0},
|
{"is-active", is_active, 0},
|
||||||
{"check-name", check_name, 0},
|
{"check-name", check_name, 0},
|
||||||
{"config", module_config, 0},
|
{"config", module_config, 0},
|
||||||
|
|
|
@ -50,6 +50,14 @@ m,message= use the given message as the commit message for the merge commit
|
||||||
|
|
||||||
indent=0
|
indent=0
|
||||||
|
|
||||||
|
# Usage: say [MSG...]
|
||||||
|
say () {
|
||||||
|
if test -z "$arg_quiet"
|
||||||
|
then
|
||||||
|
printf '%s\n' "$*"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: debug [MSG...]
|
# Usage: debug [MSG...]
|
||||||
debug () {
|
debug () {
|
||||||
if test -n "$arg_debug"
|
if test -n "$arg_debug"
|
||||||
|
@ -60,7 +68,7 @@ debug () {
|
||||||
|
|
||||||
# Usage: progress [MSG...]
|
# Usage: progress [MSG...]
|
||||||
progress () {
|
progress () {
|
||||||
if test -z "$GIT_QUIET"
|
if test -z "$arg_quiet"
|
||||||
then
|
then
|
||||||
if test -z "$arg_debug"
|
if test -z "$arg_debug"
|
||||||
then
|
then
|
||||||
|
@ -146,6 +154,7 @@ main () {
|
||||||
eval "$set_args"
|
eval "$set_args"
|
||||||
|
|
||||||
# Begin "real" flag parsing.
|
# Begin "real" flag parsing.
|
||||||
|
arg_quiet=
|
||||||
arg_debug=
|
arg_debug=
|
||||||
arg_prefix=
|
arg_prefix=
|
||||||
arg_split_branch=
|
arg_split_branch=
|
||||||
|
@ -161,7 +170,7 @@ main () {
|
||||||
|
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
-q)
|
-q)
|
||||||
GIT_QUIET=1
|
arg_quiet=1
|
||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
arg_debug=1
|
arg_debug=1
|
||||||
|
@ -252,7 +261,7 @@ main () {
|
||||||
dir="$(dirname "$arg_prefix/.")"
|
dir="$(dirname "$arg_prefix/.")"
|
||||||
|
|
||||||
debug "command: {$arg_command}"
|
debug "command: {$arg_command}"
|
||||||
debug "quiet: {$GIT_QUIET}"
|
debug "quiet: {$arg_quiet}"
|
||||||
debug "dir: {$dir}"
|
debug "dir: {$dir}"
|
||||||
debug "opts: {$*}"
|
debug "opts: {$*}"
|
||||||
debug
|
debug
|
||||||
|
|
|
@ -102,7 +102,7 @@ resolve_full_httpd () {
|
||||||
|
|
||||||
start_httpd () {
|
start_httpd () {
|
||||||
if test -f "$fqgitdir/pid"; then
|
if test -f "$fqgitdir/pid"; then
|
||||||
say "Instance already running. Restarting..."
|
echo "Instance already running. Restarting..."
|
||||||
stop_httpd
|
stop_httpd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -57,15 +57,6 @@ die_with_status () {
|
||||||
exit "$status"
|
exit "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
GIT_QUIET=
|
|
||||||
|
|
||||||
say () {
|
|
||||||
if test -z "$GIT_QUIET"
|
|
||||||
then
|
|
||||||
printf '%s\n' "$*"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if test -n "$OPTIONS_SPEC"; then
|
if test -n "$OPTIONS_SPEC"; then
|
||||||
usage() {
|
usage() {
|
||||||
"$0" -h
|
"$0" -h
|
||||||
|
@ -285,13 +276,6 @@ get_author_ident_from_commit () {
|
||||||
parse_ident_from_commit author AUTHOR
|
parse_ident_from_commit author AUTHOR
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clear repo-local GIT_* environment variables. Useful when switching to
|
|
||||||
# another repository (e.g. when entering a submodule). See also the env
|
|
||||||
# list in git_connect()
|
|
||||||
clear_local_git_env() {
|
|
||||||
unset $(git rev-parse --local-env-vars)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Generate a virtual base file for a two-file merge. Uses git apply to
|
# Generate a virtual base file for a two-file merge. Uses git apply to
|
||||||
# remove lines from $1 that are not in $2, leaving only common lines.
|
# remove lines from $1 that are not in $2, leaving only common lines.
|
||||||
create_virtual_base() {
|
create_virtual_base() {
|
||||||
|
|
|
@ -30,6 +30,7 @@ GIT_PROTOCOL_FROM_USER=0
|
||||||
export GIT_PROTOCOL_FROM_USER
|
export GIT_PROTOCOL_FROM_USER
|
||||||
|
|
||||||
command=
|
command=
|
||||||
|
quiet=
|
||||||
branch=
|
branch=
|
||||||
force=
|
force=
|
||||||
reference=
|
reference=
|
||||||
|
@ -40,8 +41,9 @@ require_init=
|
||||||
files=
|
files=
|
||||||
remote=
|
remote=
|
||||||
nofetch=
|
nofetch=
|
||||||
update=
|
rebase=
|
||||||
prefix=
|
merge=
|
||||||
|
checkout=
|
||||||
custom_name=
|
custom_name=
|
||||||
depth=
|
depth=
|
||||||
progress=
|
progress=
|
||||||
|
@ -56,17 +58,6 @@ isnumber()
|
||||||
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
|
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Sanitize the local git environment for use within a submodule. We
|
|
||||||
# can't simply use clear_local_git_env since we want to preserve some
|
|
||||||
# of the settings from GIT_CONFIG_PARAMETERS.
|
|
||||||
sanitize_submodule_env()
|
|
||||||
{
|
|
||||||
save_config=$GIT_CONFIG_PARAMETERS
|
|
||||||
clear_local_git_env
|
|
||||||
GIT_CONFIG_PARAMETERS=$save_config
|
|
||||||
export GIT_CONFIG_PARAMETERS
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add a new submodule to the working tree, .gitmodules and the index
|
# Add a new submodule to the working tree, .gitmodules and the index
|
||||||
#
|
#
|
||||||
|
@ -90,7 +81,7 @@ cmd_add()
|
||||||
force=$1
|
force=$1
|
||||||
;;
|
;;
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--progress)
|
--progress)
|
||||||
progress=1
|
progress=1
|
||||||
|
@ -138,7 +129,7 @@ cmd_add()
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper add ${GIT_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"} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -154,7 +145,7 @@ cmd_foreach()
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--recursive)
|
--recursive)
|
||||||
recursive=1
|
recursive=1
|
||||||
|
@ -169,7 +160,7 @@ cmd_foreach()
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -184,7 +175,7 @@ cmd_init()
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
|
@ -200,7 +191,7 @@ cmd_init()
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper init ${GIT_QUIET:+--quiet} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init ${quiet:+--quiet} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -217,7 +208,7 @@ cmd_deinit()
|
||||||
force=$1
|
force=$1
|
||||||
;;
|
;;
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--all)
|
--all)
|
||||||
deinit_all=t
|
deinit_all=t
|
||||||
|
@ -236,7 +227,7 @@ cmd_deinit()
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${GIT_QUIET:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit ${quiet:+--quiet} ${force:+--force} ${deinit_all:+--all} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -251,10 +242,7 @@ cmd_update()
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
|
||||||
-v)
|
|
||||||
unset GIT_QUIET
|
|
||||||
;;
|
;;
|
||||||
--progress)
|
--progress)
|
||||||
progress=1
|
progress=1
|
||||||
|
@ -263,7 +251,6 @@ cmd_update()
|
||||||
init=1
|
init=1
|
||||||
;;
|
;;
|
||||||
--require-init)
|
--require-init)
|
||||||
init=1
|
|
||||||
require_init=1
|
require_init=1
|
||||||
;;
|
;;
|
||||||
--remote)
|
--remote)
|
||||||
|
@ -276,7 +263,7 @@ cmd_update()
|
||||||
force=$1
|
force=$1
|
||||||
;;
|
;;
|
||||||
-r|--rebase)
|
-r|--rebase)
|
||||||
update="rebase"
|
rebase=1
|
||||||
;;
|
;;
|
||||||
--reference)
|
--reference)
|
||||||
case "$2" in '') usage ;; esac
|
case "$2" in '') usage ;; esac
|
||||||
|
@ -290,13 +277,13 @@ cmd_update()
|
||||||
dissociate=1
|
dissociate=1
|
||||||
;;
|
;;
|
||||||
-m|--merge)
|
-m|--merge)
|
||||||
update="merge"
|
merge=1
|
||||||
;;
|
;;
|
||||||
--recursive)
|
--recursive)
|
||||||
recursive=1
|
recursive=1
|
||||||
;;
|
;;
|
||||||
--checkout)
|
--checkout)
|
||||||
update="checkout"
|
checkout=1
|
||||||
;;
|
;;
|
||||||
--recommend-shallow)
|
--recommend-shallow)
|
||||||
recommend_shallow="--recommend-shallow"
|
recommend_shallow="--recommend-shallow"
|
||||||
|
@ -349,7 +336,7 @@ cmd_update()
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \
|
||||||
${GIT_QUIET:+--quiet} \
|
${quiet:+--quiet} \
|
||||||
${force:+--force} \
|
${force:+--force} \
|
||||||
${progress:+"--progress"} \
|
${progress:+"--progress"} \
|
||||||
${remote:+--remote} \
|
${remote:+--remote} \
|
||||||
|
@ -357,8 +344,9 @@ cmd_update()
|
||||||
${init:+--init} \
|
${init:+--init} \
|
||||||
${nofetch:+--no-fetch} \
|
${nofetch:+--no-fetch} \
|
||||||
${wt_prefix:+--prefix "$wt_prefix"} \
|
${wt_prefix:+--prefix "$wt_prefix"} \
|
||||||
${prefix:+--recursive-prefix "$prefix"} \
|
${rebase:+--rebase} \
|
||||||
${update:+--update "$update"} \
|
${merge:+--merge} \
|
||||||
|
${checkout:+--checkout} \
|
||||||
${reference:+"$reference"} \
|
${reference:+"$reference"} \
|
||||||
${dissociate:+"--dissociate"} \
|
${dissociate:+"--dissociate"} \
|
||||||
${depth:+"$depth"} \
|
${depth:+"$depth"} \
|
||||||
|
@ -409,7 +397,7 @@ cmd_set_branch() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${GIT_QUIET:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch ${quiet:+--quiet} ${branch:+--branch "$branch"} ${default:+--default} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -422,7 +410,7 @@ cmd_set_url() {
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
|
@ -438,7 +426,7 @@ cmd_set_url() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${GIT_QUIET:+--quiet} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url ${quiet:+--quiet} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -459,7 +447,7 @@ cmd_summary() {
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--cached)
|
--cached)
|
||||||
cached="$1"
|
cached=1
|
||||||
;;
|
;;
|
||||||
--files)
|
--files)
|
||||||
files="$1"
|
files="$1"
|
||||||
|
@ -509,7 +497,7 @@ cmd_status()
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
;;
|
||||||
--cached)
|
--cached)
|
||||||
cached=1
|
cached=1
|
||||||
|
@ -531,7 +519,7 @@ cmd_status()
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status ${GIT_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
|
||||||
|
@ -544,7 +532,7 @@ cmd_sync()
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--recursive)
|
--recursive)
|
||||||
|
@ -564,12 +552,12 @@ cmd_sync()
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@"
|
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_absorbgitdirs()
|
cmd_absorbgitdirs()
|
||||||
{
|
{
|
||||||
git submodule--helper absorb-git-dirs --prefix "$wt_prefix" "$@"
|
git submodule--helper absorbgitdirs --prefix "$wt_prefix" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# This loop parses the command line arguments to find the
|
# This loop parses the command line arguments to find the
|
||||||
|
@ -585,18 +573,10 @@ do
|
||||||
command=$1
|
command=$1
|
||||||
;;
|
;;
|
||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
quiet=1
|
||||||
;;
|
|
||||||
-b|--branch)
|
|
||||||
case "$2" in
|
|
||||||
'')
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
branch="$2"; shift
|
|
||||||
;;
|
;;
|
||||||
--cached)
|
--cached)
|
||||||
cached="$1"
|
cached=1
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
break
|
break
|
||||||
|
@ -622,12 +602,6 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# "-b branch" is accepted only by "add" and "set-branch"
|
|
||||||
if test -n "$branch" && (test "$command" != add || test "$command" != set-branch)
|
|
||||||
then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
|
|
||||||
# "--cached" is accepted only by "status" and "summary"
|
# "--cached" is accepted only by "status" and "summary"
|
||||||
if test -n "$cached" && test "$command" != status && test "$command" != summary
|
if test -n "$cached" && test "$command" != status && test "$command" != summary
|
||||||
then
|
then
|
||||||
|
|
|
@ -2374,7 +2374,7 @@ void absorb_git_dir_into_superproject(const char *path,
|
||||||
cp.no_stdin = 1;
|
cp.no_stdin = 1;
|
||||||
strvec_pushl(&cp.args, "--super-prefix", sb.buf,
|
strvec_pushl(&cp.args, "--super-prefix", sb.buf,
|
||||||
"submodule--helper",
|
"submodule--helper",
|
||||||
"absorb-git-dirs", NULL);
|
"absorbgitdirs", NULL);
|
||||||
prepare_submodule_repo_env(&cp.env);
|
prepare_submodule_repo_env(&cp.env);
|
||||||
if (run_command(&cp))
|
if (run_command(&cp))
|
||||||
die(_("could not recurse into submodule '%s'"), path);
|
die(_("could not recurse into submodule '%s'"), path);
|
||||||
|
|
|
@ -1074,7 +1074,7 @@ test_expect_success 'submodule update --quiet passes quietness to merge/rebase'
|
||||||
git submodule update --rebase --quiet >out 2>err &&
|
git submodule update --rebase --quiet >out 2>err &&
|
||||||
test_must_be_empty out &&
|
test_must_be_empty out &&
|
||||||
test_must_be_empty err &&
|
test_must_be_empty err &&
|
||||||
git submodule update --rebase -v >out 2>err &&
|
git submodule update --rebase >out 2>err &&
|
||||||
test_file_not_empty out &&
|
test_file_not_empty out &&
|
||||||
test_must_be_empty err
|
test_must_be_empty err
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue