git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fast-import: tag may point to any object type
@ 2010-01-11  5:02 Dmitry Potapov
  2010-01-11 17:14 ` Shawn O. Pearce
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Potapov @ 2010-01-11  5:02 UTC (permalink / raw)
  To: git, git; +Cc: Dmitry Potapov, Junio C Hamano, Shawn O. Pearce

If you tried to export the official git repository, and then to import it
back then git-fast-import would die complaining that "Mark :1 not a commit".

Accordingly to a generated crash file, Mark 1 is not a commit but a blob,
which is pointed by junio-gpg-pub tag. Because git-tag allows to create such
tags, git-fast-import should import them.

Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
---
 fast-import.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index cd87049..e99990d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2305,6 +2305,7 @@ static void parse_new_tag(void)
 	struct tag *t;
 	uintmax_t from_mark = 0;
 	unsigned char sha1[20];
+	enum object_type type = OBJ_COMMIT;
 
 	/* Obtain the new tag name from the rest of our command */
 	sp = strchr(command_buf.buf, ' ') + 1;
@@ -2329,8 +2330,7 @@ static void parse_new_tag(void)
 		struct object_entry *oe;
 		from_mark = strtoumax(from + 1, NULL, 10);
 		oe = find_mark(from_mark);
-		if (oe->type != OBJ_COMMIT)
-			die("Mark :%" PRIuMAX " not a commit", from_mark);
+		type = oe->type;
 		hashcpy(sha1, oe->sha1);
 	} else if (!get_sha1(from, sha1)) {
 		unsigned long size;
@@ -2362,7 +2362,7 @@ static void parse_new_tag(void)
 		    "object %s\n"
 		    "type %s\n"
 		    "tag %s\n",
-		    sha1_to_hex(sha1), commit_type, t->name);
+		    sha1_to_hex(sha1), typename(type), t->name);
 	if (tagger)
 		strbuf_addf(&new_data,
 			    "tagger %s\n", tagger);
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-14  4:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11  5:02 [PATCH] fast-import: tag may point to any object type Dmitry Potapov
2010-01-11 17:14 ` Shawn O. Pearce
2010-01-13 12:35   ` [PATCH v2] " Dmitry Potapov
2010-01-13 17:24     ` Shawn O. Pearce
2010-01-14  4:44       ` [PATCH v3] " Dmitry Potapov

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).