Skip to content

Commit a388373

Browse files
torvaldsgitster
authored andcommitted
Improve on the 'invalid object' error message at commit time
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f222abd commit a388373

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cache-tree.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ static int update_one(struct cache_tree *it,
329329
entlen = pathlen - baselen;
330330
}
331331
if (mode != S_IFGITLINK && !missing_ok && !has_sha1_file(sha1))
332-
return error("invalid object %s", sha1_to_hex(sha1));
332+
return error("invalid object %06o %s for '%.*s'",
333+
mode, sha1_to_hex(sha1), entlen+baselen, path);
333334

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

0 commit comments

Comments
 (0)