threads / patch / 1675

patchgit-rev-list: Don't die on a bad tag

Subject: [PATCH] git-rev-list: Don't die on a bad tag

## tl;dr

2 messages between Aug 27, 2005 and Aug 27, 2005. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Frank Sorenson· Aug 27, 2005, 08:17 UTC · lore
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The current cogito tree contains an invalid tag (junio-gpg-pub => 0918385dbd9656cab0d1d81ba7453d49bbc16250), and git-repack-script (and probably others) will die when git-rev-list tries to dump the objects. This patch changes it to complain, but continue.

Signed-off-by: Frank Sorenson <frank@tuxrocks.com>
Show changes to rev-list.c +4 −4
diff --git a/rev-list.c b/rev-list.c
- --- a/rev-list.c
+++ b/rev-list.c
@@ -418,8 +418,10 @@ static struct commit *get_commit_referen
 		if (tag_objects && !(object->flags & UNINTERESTING))
 			add_pending_object(object, tag->tag);
 		object = parse_object(tag->tagged->sha1);
- -		if (!object)
- -			die("bad object %s", sha1_to_hex(tag->tagged->sha1));
+		if (!object) {
+			fprintf(stderr, "Bad tag: %s\n", sha1_to_hex(tag->tagged->sha1));
+			return NULL;
+		}
 	}
 
 	/*


Frank
- -- 
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDECF9aI0dwg4A47wRAncdAKCIcNFzihLm9cy7RWRKakM6INikigCfcCvu
R/XG+XlMsbgWesEvZcFBmQY=
=OY7G
-----END PGP SIGNATURE-----
Junio C Hamano· Aug 27, 2005, 09:14 UTC · re: Frank Sorenson · lore

Re: [PATCH] git-rev-list: Don't die on a bad tag

Frank Sorenson <frank@tuxrocks.com> writes:
Show 7 quoted lines
> The current cogito tree contains an invalid tag
> (junio-gpg-pub => 0918385dbd9656cab0d1d81ba7453d49bbc16250), and
> git-repack-script (and probably others) will die when git-rev-list
> tries to dump the objects.  This patch changes it to complain, but
> continue.
>
> Signed-off-by: Frank Sorenson <frank@tuxrocks.com>
I think this patch is wrong.

The check you are disabling is to see if the repository contains an object that a tag refers to, and the user wanted to slurp the tag, along with whatever thing it refers to, so barfing and dying is the only right thing to do.

The repository does not have the object the tag points at. IOW, the repository is not fsck clean.

If it bothers you either you could drop that tag from cogito repository (because there would not be anything that is signed by _my_ public key anyway), or borrow the object from git.git repository.

← back to recent threads