aboutsummaryrefslogtreecommitdiffstats
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2016-05-31 16:59:33 -0700
committerJunio C Hamano <gitster@pobox.com>2016-06-01 11:31:49 -0700
commitb0f4b4084626ab0f87611acd89030e8bdf0b850e (patch)
tree7e4419d2415305c02bb85eb300389176000835ee /git-submodule.sh
parent60bd4b1c513bb652cdffad44382046ca872140eb (diff)
downloadgit-b0f4b4084626ab0f87611acd89030e8bdf0b850e.tar.gz
submodule--helper: offer a consistent API
In 48308681 (2016-02-29, git submodule update: have a dedicated helper for cloning), the helper communicated errors back only via exit code, and dance with printing '#unmatched' in case of error was left to git-submodule.sh as it uses the output of the helper and pipes it into shell commands. This change makes the helper consistent by never printing '#unmatched' in the helper but always handling these piping issues in the actual shell script. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh20
1 files changed, 16 insertions, 4 deletions
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"