summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-19 02:15:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-19 02:15:12 (GMT)
commit6304c4068e034c5bb780b755cf518010027a1734 (patch)
treeeed2f10c7b862365147b74e756d0473c659afdb4 /fast-import.c
parent7d0dafe3945408aeef9c2e5256ac926976170e54 (diff)
parent8db751a8f953bf1a571e1fd825d1a4219e65b501 (diff)
downloadgit-6304c4068e034c5bb780b755cf518010027a1734.zip
git-6304c4068e034c5bb780b755cf518010027a1734.tar.gz
git-6304c4068e034c5bb780b755cf518010027a1734.tar.bz2
Merge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint
* dp/maint-1.6.5-fast-import-non-commit-tag: fast-import: tag may point to any object type
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fast-import.c b/fast-import.c
index cd87049..60d0aa2 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;
/* Obtain the new tag name from the rest of our command */
sp = strchr(command_buf.buf, ' ') + 1;
@@ -2325,19 +2326,18 @@ static void parse_new_tag(void)
s = lookup_branch(from);
if (s) {
hashcpy(sha1, s->sha1);
+ type = OBJ_COMMIT;
} else if (*from == ':') {
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;
char *buf;
- buf = read_object_with_reference(sha1,
- commit_type, &size, sha1);
+ buf = read_sha1_file(sha1, &type, &size);
if (!buf || size < 46)
die("Not a valid commit: %s", from);
free(buf);
@@ -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);