git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: Confusing submodule error message
@ 2011-12-06 19:30 Seth Robertson
  2011-12-07 21:50 ` [PATCH] diff/status: print submodule path when looking for changes fails Jens Lehmann
  0 siblings, 1 reply; 3+ messages in thread
From: Seth Robertson @ 2011-12-06 19:30 UTC (permalink / raw)
  To: git


Someone on #git just encountered a problem where `git init && git add . &&
git status` was failing with a message about a corrupted index.

    error: bad index file sha1 signature
    fatal: index file corrupt
    fatal: git status --porcelain failed

This confused everyone for a while, until he provided access to the
directory to play with.  I eventually tracked it down to a directory
in the tree which already had a .git directory in it.  Unfortunately,
that .git repo was corrupted and was the one returning the message
about a corrupted index.  The problem is that the error message we
were seeing did not provide any direct hints that submodules were
involved or that the problem was not at the top level (`git status
--porcelain` is admittedly an indirect hint to both).  Here is a
recipe to reproduce a similar problem:

(mkdir -p z/foo; cd z/foo; git init; echo A>A; git add A; git commit -m A; cd ..; echo B>B; rm -f foo/.git/objects/*/*; git init; git add .; git status)

Providing an expanded error message which clarifies that this is
failing in a submodule directory makes everything clear.

----------------------------------------------------------------------
--- submodule.c~	2011-12-02 14:25:08.000000000 -0500
+++ submodule.c	2011-12-06 14:13:00.554413432 -0500
@@ -714,7 +714,7 @@
 	close(cp.out);
 
 	if (finish_command(&cp))
-		die("git status --porcelain failed");
+		die("git status --porcelain failed in submodule directory %s", path);
 
 	strbuf_release(&buf);
 	return dirty_submodule;
----------------------------------------------------------------------

Do more error messages in submodule.c need adjusting?  It seems likely.

					-Seth Robertson

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-09 20:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 19:30 BUG: Confusing submodule error message Seth Robertson
2011-12-07 21:50 ` [PATCH] diff/status: print submodule path when looking for changes fails Jens Lehmann
2011-12-08 19:15   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).