From: Chris West <solo-git-vger@goeswhere.com>
To: git@vger.kernel.org
Subject: die("bad object.. for duplicate tagged tag in remote
Date: Fri, 19 May 2017 18:28:56 +0100 [thread overview]
Message-ID: <20170519172856.GA14673@blind.goeswhere.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1709 bytes --]
Bear with me here, I hit this in a real repo.
If you have an annotated tag of an annotated tag, and `remote update`
elects not to fetch this tag (perhaps because it has a name collision
locally), then the repo ends up corrupt: you can't gc it, but fsck
doesn't notice.
Two repos, named "bad" and "good":
bad$ git tag -a inner
bad$ git tag -a outer inner
bad$ git tag -d inner
bad$ git show outer
tag outer
Tagger: ...
Date: ...
This is the outer tag.
tag inner
Tagger: ...
Date: ...
This is the inner tag.
commit 826365dcfec304a80b227a990f7d5c805bce3dd9
Author: ...
...
bad$ git rev-parse outer
070707..
bad$ git cat-file tag outer
object 03030303...
good$ git tag -a outer # create a colliding tag
good$ git remote add bad ../bad
good$ git remote update
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From ../bad
* [new branch] master -> bad/master
Note how it has not fetched the tag ref, but it has fetched one of the
tag objects:
$ git show 07070
error: Could not read object 0303030..
tag outer
Tagger: ...
$ git fsck
...
dangling tag 07070...
I actually don't get that on the real repo, but do on this testcase. Hmm.
`git fsck` exits with success here. This is bad, as the object graph is
incomplete?
$ git gc
fatal: bad object 03030303...
error: failed to run repack
`git gc` fails with this meaningless error. The attached patch improves
the error.
I don't know where the rest of the problem lies. What's the expected
behaviour when a tag already exists locally, but is different? Fetch
the object anyway, but ignore it?
[-- Attachment #2: 0001-print-tag-id-when-tagged-object-is-bad.patch --]
[-- Type: text/x-diff, Size: 745 bytes --]
From aa861789077012f78605431e1a1f191292693325 Mon Sep 17 00:00:00 2001
From: "Chris West (Faux)" <git@goeswhere.com>
Date: Fri, 19 May 2017 19:24:03 +0200
Subject: [PATCH] print tag id when tagged object is bad
---
revision.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/revision.c b/revision.c
index 8a8c178..22b6021 100644
--- a/revision.c
+++ b/revision.c
@@ -232,7 +232,8 @@ static struct commit *handle_commit(struct rev_info *revs,
if (!object) {
if (flags & UNINTERESTING)
return NULL;
- die("bad object %s", oid_to_hex(&tag->tagged->oid));
+ die("bad tagged object %s in %s", oid_to_hex(&tag->tagged->oid),
+ oid_to_hex(&tag->object.oid));
}
object->flags |= flags;
/*
--
2.7.4
next reply other threads:[~2017-05-19 17:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 17:28 Chris West [this message]
2017-05-20 8:03 ` die("bad object.. for duplicate tagged tag in remote Jeff King
2017-05-20 8:30 ` [PATCH] revision.c: ignore broken tags with ignore_missing_links Jeff King
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=20170519172856.GA14673@blind.goeswhere.com \
--to=solo-git-vger@goeswhere.com \
--cc=git@vger.kernel.org \
/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).