diff/status: print submodule path when looking for changes fails

diff and status run "git status --porcelain" inside each populated submodule to see if it contains changes (unless told not to do so via config or command line option). When that fails, e.g. due to a corrupt submodule .git directory, it just prints "git status --porcelain failed" or "Could not run git status --porcelain" without giving the user a clue where that happened. Add '"in submodule %s", path' to these error strings to tell the user where exactly the problem occurred. Reported-by: Seth Robertson <in-gitvger@baka.org> Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jens Lehmann committed Dec 7, 2011 at 22:50 UTC 6a5cedac87ff4f1d8d8b535dac8184e1f7fbc454
1 file changed +2 -2
submodule.c
+2 -2
@@ -148,13 +148,13 @@ int is_submodule_modified(const char *path)
148 cp.no_stdin = 1;
149 cp.out = -1;
150 if (start_command(&cp))
151 - die("Could not run git status --porcelain");
151 + die("Could not run 'git status --porcelain' in submodule %s", path);
152
153 len = strbuf_read(&buf, cp.out, 1024);
154 close(cp.out);
155
156 if (finish_command(&cp))
157 - die("git status --porcelain failed");
157 + die("'git status --porcelain' failed in submodule %s", path);
158
159 free(env[0]);
160 free(env[1]);