From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Cc: Florian Breitwieser <florian.bw@gmail.com>
Subject: [PATCH] Improve on the 'invalid object' error message at commit time
Date: Tue, 14 Jul 2009 11:25:17 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0907141119190.13838@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0907141019380.13838@localhost.localdomain>
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>
---
Not a big deal. But since somebody actually saw this message, let's just
make it more informative.
A lot of the "these can't happen unless you're seriously screwed" messages
aren't very good, because there is little upside when doing development.
But let's try to improve on them in case they happen in the future.
Not that this would make debugging much easier, but one thing that I
started wondering about was whether the problem Florian saw was about one
of the files he had done "git add" on, or whether it was a tree entry that
was the result of "find_subtree()".
cache-tree.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 16a65df..d917437 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -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 */
next prev parent reply other threads:[~2009-07-14 18:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 13:20 Recover broken git repository? Florian Breitwieser
2009-07-14 14:40 ` Alex Riesen
2009-07-14 14:54 ` Nicolas Sebrecht
2009-07-14 15:20 ` Jakub Narebski
2009-07-14 17:33 ` Linus Torvalds
2009-07-14 17:48 ` Stefan-W. Hahn
2009-07-14 17:52 ` Stefan-W. Hahn
2009-07-14 18:25 ` Linus Torvalds [this message]
2009-07-14 19:43 ` [PATCH] Improve on the 'invalid object' error message at commit time Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.01.0907141119190.13838@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=florian.bw@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).