summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorDmitry Ivankov <divanorama@gmail.com>2011-08-22 18:10:19 +0600
committerJunio C Hamano <gitster@pobox.com>2011-08-23 11:25:59 -0700
commit6c447f633cedd6e2366151b0b82b1731f8c1ee1d (patch)
treeafe7d25be73db515c5257eadf026ce83b41c9f49 /fast-import.c
parent2efe38e7da40fdf2b6e0261984d7adaab16ad930 (diff)
downloadgit-6c447f633cedd6e2366151b0b82b1731f8c1ee1d.tar.gz
fast-import: allow to tag newly created objects
fast-import allows to tag objects by sha1 and to query sha1 of objects being imported. So it should allow to tag these objects, make it do so. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fast-import.c b/fast-import.c
index ca21458612..4f56f772a3 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2688,9 +2688,13 @@ static void parse_new_tag(void)
type = oe->type;
hashcpy(sha1, oe->idx.sha1);
} else if (!get_sha1(from, sha1)) {
- type = sha1_object_info(sha1, NULL);
- if (type < 0)
- die("Not a valid object: %s", from);
+ struct object_entry *oe = find_object(sha1);
+ if (!oe) {
+ type = sha1_object_info(sha1, NULL);
+ if (type < 0)
+ die("Not a valid object: %s", from);
+ } else
+ type = oe->type;
} else
die("Invalid ref name or SHA1 expression: %s", from);
read_next_command();