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

No differences found