diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-06-06 14:18:55 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-06-06 14:18:55 -0700 |
commit | f6136f3c39a4e7b9b98c11e69d38e15f5705204b (patch) | |
tree | 6fa35446df8efc267e17c139d08a3114024f37e3 | |
parent | Almost ready for 2.9-rc2 (diff) | |
parent | submodule--helper: offer a consistent API (diff) | |
download | tgif-f6136f3c39a4e7b9b98c11e69d38e15f5705204b.tar.xz |
Merge branch 'sb/submodule-helper-list-signal-unmatch-via-exit-status'
The way how "submodule--helper list" signals unmatch error to its
callers has been updated.
* sb/submodule-helper-list-signal-unmatch-via-exit-status:
submodule--helper: offer a consistent API
-rw-r--r-- | builtin/submodule--helper.c | 4 | ||||
-rwxr-xr-x | git-submodule.sh | 20 |
2 files changed, 17 insertions, 7 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 8da263f0b0..f0b2c4fe0b 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -287,10 +287,8 @@ static int module_list(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, prefix, module_list_options, git_submodule_helper_usage, 0); - if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) { - printf("#unmatched\n"); + if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) return 1; - } for (i = 0; i < list.nr; i++) { const struct cache_entry *ce = list.entries[i]; diff --git a/git-submodule.sh b/git-submodule.sh index 5a4dec050b..fadbe5d3e0 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -345,7 +345,10 @@ cmd_foreach() # command in the subshell (and a recursive call to this function) exec 3<&0 - git submodule--helper list --prefix "$wt_prefix"| + { + git submodule--helper list --prefix "$wt_prefix" || + echo "#unmatched" + } | while read mode sha1 stage sm_path do die_if_unmatched "$mode" @@ -453,7 +456,10 @@ cmd_deinit() die "$(eval_gettext "Use '--all' if you really want to deinitialize all submodules")" fi - git submodule--helper list --prefix "$wt_prefix" "$@" | + { + git submodule--helper list --prefix "$wt_prefix" "$@" || + echo "#unmatched" + } | while read mode sha1 stage sm_path do die_if_unmatched "$mode" @@ -1013,7 +1019,10 @@ cmd_status() shift done - git submodule--helper list --prefix "$wt_prefix" "$@" | + { + git submodule--helper list --prefix "$wt_prefix" "$@" || + echo "#unmatched" + } | while read mode sha1 stage sm_path do die_if_unmatched "$mode" @@ -1091,7 +1100,10 @@ cmd_sync() esac done cd_to_toplevel - git submodule--helper list --prefix "$wt_prefix" "$@" | + { + git submodule--helper list --prefix "$wt_prefix" "$@" || + echo "#unmatched" + } | while read mode sha1 stage sm_path do die_if_unmatched "$mode" |