Skip to content

Commit e770655

Browse files
committed
Merge branch 'dp/maint-1.6.5-fast-import-non-commit-tag' into maint-1.6.5
* dp/maint-1.6.5-fast-import-non-commit-tag: fast-import: tag may point to any object type
2 parents 27132ca + 8db751a commit e770655

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fast-import.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,6 +2225,7 @@ static void parse_new_tag(void)
22252225
struct tag *t;
22262226
uintmax_t from_mark = 0;
22272227
unsigned char sha1[20];
2228+
enum object_type type;
22282229

22292230
/* Obtain the new tag name from the rest of our command */
22302231
sp = strchr(command_buf.buf, ' ') + 1;
@@ -2245,19 +2246,18 @@ static void parse_new_tag(void)
22452246
s = lookup_branch(from);
22462247
if (s) {
22472248
hashcpy(sha1, s->sha1);
2249+
type = OBJ_COMMIT;
22482250
} else if (*from == ':') {
22492251
struct object_entry *oe;
22502252
from_mark = strtoumax(from + 1, NULL, 10);
22512253
oe = find_mark(from_mark);
2252-
if (oe->type != OBJ_COMMIT)
2253-
die("Mark :%" PRIuMAX " not a commit", from_mark);
2254+
type = oe->type;
22542255
hashcpy(sha1, oe->sha1);
22552256
} else if (!get_sha1(from, sha1)) {
22562257
unsigned long size;
22572258
char *buf;
22582259

2259-
buf = read_object_with_reference(sha1,
2260-
commit_type, &size, sha1);
2260+
buf = read_sha1_file(sha1, &type, &size);
22612261
if (!buf || size < 46)
22622262
die("Not a valid commit: %s", from);
22632263
free(buf);
@@ -2282,7 +2282,7 @@ static void parse_new_tag(void)
22822282
"object %s\n"
22832283
"type %s\n"
22842284
"tag %s\n",
2285-
sha1_to_hex(sha1), commit_type, t->name);
2285+
sha1_to_hex(sha1), typename(type), t->name);
22862286
if (tagger)
22872287
strbuf_addf(&new_data,
22882288
"tagger %s\n", tagger);

0 commit comments

Comments
 (0)