Skip to content

Commit f6136f3

Browse files
committed
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
2 parents 6326f19 + b0f4b40 commit f6136f3

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

builtin/submodule--helper.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,8 @@ static int module_list(int argc, const char **argv, const char *prefix)
287287
argc = parse_options(argc, argv, prefix, module_list_options,
288288
git_submodule_helper_usage, 0);
289289

290-
if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0) {
291-
printf("#unmatched\n");
290+
if (module_list_compute(argc, argv, prefix, &pathspec, &list) < 0)
292291
return 1;
293-
}
294292

295293
for (i = 0; i < list.nr; i++) {
296294
const struct cache_entry *ce = list.entries[i];

git-submodule.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ cmd_foreach()
345345
# command in the subshell (and a recursive call to this function)
346346
exec 3<&0
347347

348-
git submodule--helper list --prefix "$wt_prefix"|
348+
{
349+
git submodule--helper list --prefix "$wt_prefix" ||
350+
echo "#unmatched"
351+
} |
349352
while read mode sha1 stage sm_path
350353
do
351354
die_if_unmatched "$mode"
@@ -453,7 +456,10 @@ cmd_deinit()
453456
die "$(eval_gettext "Use '--all' if you really want to deinitialize all submodules")"
454457
fi
455458

456-
git submodule--helper list --prefix "$wt_prefix" "$@" |
459+
{
460+
git submodule--helper list --prefix "$wt_prefix" "$@" ||
461+
echo "#unmatched"
462+
} |
457463
while read mode sha1 stage sm_path
458464
do
459465
die_if_unmatched "$mode"
@@ -1013,7 +1019,10 @@ cmd_status()
10131019
shift
10141020
done
10151021

1016-
git submodule--helper list --prefix "$wt_prefix" "$@" |
1022+
{
1023+
git submodule--helper list --prefix "$wt_prefix" "$@" ||
1024+
echo "#unmatched"
1025+
} |
10171026
while read mode sha1 stage sm_path
10181027
do
10191028
die_if_unmatched "$mode"
@@ -1091,7 +1100,10 @@ cmd_sync()
10911100
esac
10921101
done
10931102
cd_to_toplevel
1094-
git submodule--helper list --prefix "$wt_prefix" "$@" |
1103+
{
1104+
git submodule--helper list --prefix "$wt_prefix" "$@" ||
1105+
echo "#unmatched"
1106+
} |
10951107
while read mode sha1 stage sm_path
10961108
do
10971109
die_if_unmatched "$mode"

0 commit comments

Comments
 (0)