Skip to content

Commit

Permalink
diff/status: print submodule path when looking for changes fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Lehmann authored and Junio C Hamano committed Dec 8, 2011
1 parent ee6fc51 commit 6a5ceda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions submodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ int is_submodule_modified(const char *path)
cp.no_stdin = 1;
cp.out = -1;
if (start_command(&cp))
die("Could not run git status --porcelain");
die("Could not run 'git status --porcelain' in submodule %s", path);

len = strbuf_read(&buf, cp.out, 1024);
close(cp.out);

if (finish_command(&cp))
die("git status --porcelain failed");
die("'git status --porcelain' failed in submodule %s", path);

free(env[0]);
free(env[1]);
Expand Down

0 comments on commit 6a5ceda

Please sign in to comment.