summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2efe38e)
raw | patch | inline | side by side (parent: 2efe38e)
author | Dmitry Ivankov <divanorama@gmail.com> | |
Mon, 22 Aug 2011 12:10:19 +0000 (18:10 +0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 23 Aug 2011 18:25:59 +0000 (11:25 -0700) |
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>
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>
fast-import.c | patch | blob | history | |
t/t9300-fast-import.sh | patch | blob | history |
diff --git a/fast-import.c b/fast-import.c
index ca21458612a68c26b610a31ca009259c05cd08e1..4f56f772a33c353b296223123e7e0d5307ec0a48 100644 (file)
--- a/fast-import.c
+++ b/fast-import.c
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();
diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh
index 80b06f0714cb56610502556669190b1475c4dbe1..ab9493478cdaf4036bf1b79988cc2fac0fa22f4b 100755 (executable)
--- a/t/t9300-fast-import.sh
+++ b/t/t9300-fast-import.sh
test_cmp expect marks.new'
test_tick
+new_blob=$(echo testing | git hash-object --stdin)
cat >input <<INPUT_END
tag series-A-blob-2
from $(git rev-parse refs/heads/master:file3)
data <<EOF
Tag blob by sha1.
EOF
+
+blob
+mark :6
+data <<EOF
+testing
+EOF
+
+commit refs/heads/new_blob
+committer <> 0 +0000
+data 0
+M 644 :6 new_blob
+#pretend we got sha1 from fast-import
+ls "new_blob"
+
+tag series-A-blob-3
+from $new_blob
+data <<EOF
+Tag new_blob.
+EOF
INPUT_END
cat >expect <<EOF
tag series-A-blob-2
Tag blob by sha1.
+object $new_blob
+type blob
+tag series-A-blob-3
+
+Tag new_blob.
EOF
test_expect_success \
'A: tag blob by sha1' \
'git fast-import <input &&
git cat-file tag tags/series-A-blob-2 >actual &&
+ git cat-file tag tags/series-A-blob-3 >>actual &&
test_cmp expect actual'
test_tick