Let submodule command exit with error status if path does not exist
commitbe9d0a3a4cbd736911afc10154c7a541129503bd
authorHeiko Voigt <hvoigt@hvoigt.net>
Tue, 14 Aug 2012 20:35:27 +0000 (14 22:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Aug 2012 21:00:17 +0000 (14 14:00 -0700)
treec06beff28e7409a07e3a04c68e2c00a23715c6c2
parentb17a01df49a43e0edd7d26397deb79c1b1089d0c
Let submodule command exit with error status if path does not exist

Various subcommands of the "git submodule" command exited with 0
status even though the path given by the user did not exist.

The reason behind that was that they all pipe the output of
module_list into the while loop which then does the action on the
paths specified by the commandline. Since the exit code of the
command on the upstream side of the pipe is ignored by the shell,
the status code of "ls-files --error-unmatch" nor "module_list" was
not propagated.

In case ls-files returns with an error code, we write a special
string that is not possible in non error situations, and no other
output, so that the downstream can detect the error and die with an
error code.

The error message that there is an unmatched pathspec comes through
stderr directly from ls-files. So the user still gets a hint whats going
on.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-submodule.sh
t/t7400-submodule-basic.sh