Skip to content

Commit

Permalink
Improve on the 'invalid object' error message at commit time
Browse files Browse the repository at this point in the history
Not that anybody should ever get it, but somebody did (probably because
of a flaky filesystem, but whatever).  And each time I see an error
message that I haven't seen before, I decide that next time it will look
better.

So this makes us write more relevant information about exactly which
file ended up having issues with a missing object.  Which will tell
whether it was a tree object, for example, or just a regular file in the
index (and which one).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Jul 14, 2009
1 parent f222abd commit a388373
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cache-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ static int update_one(struct cache_tree *it,
entlen = pathlen - baselen;
}
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
return error("invalid object %s", sha1_to_hex(sha1));
return error("invalid object %06o %s for '%.*s'",
mode, sha1_to_hex(sha1), entlen+baselen, path);

if (ce->ce_flags & CE_REMOVE)
continue; /* entry being removed */
Expand Down

0 comments on commit a388373

Please sign in to comment.