зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
2efe38e7da
Коммит
6c447f633c
|
@ -2688,9 +2688,13 @@ static void parse_new_tag(void)
|
||||||
type = oe->type;
|
type = oe->type;
|
||||||
hashcpy(sha1, oe->idx.sha1);
|
hashcpy(sha1, oe->idx.sha1);
|
||||||
} else if (!get_sha1(from, sha1)) {
|
} else if (!get_sha1(from, sha1)) {
|
||||||
type = sha1_object_info(sha1, NULL);
|
struct object_entry *oe = find_object(sha1);
|
||||||
if (type < 0)
|
if (!oe) {
|
||||||
die("Not a valid object: %s", from);
|
type = sha1_object_info(sha1, NULL);
|
||||||
|
if (type < 0)
|
||||||
|
die("Not a valid object: %s", from);
|
||||||
|
} else
|
||||||
|
type = oe->type;
|
||||||
} else
|
} else
|
||||||
die("Invalid ref name or SHA1 expression: %s", from);
|
die("Invalid ref name or SHA1 expression: %s", from);
|
||||||
read_next_command();
|
read_next_command();
|
||||||
|
|
|
@ -188,12 +188,32 @@ test_expect_success \
|
||||||
test_cmp expect marks.new'
|
test_cmp expect marks.new'
|
||||||
|
|
||||||
test_tick
|
test_tick
|
||||||
|
new_blob=$(echo testing | git hash-object --stdin)
|
||||||
cat >input <<INPUT_END
|
cat >input <<INPUT_END
|
||||||
tag series-A-blob-2
|
tag series-A-blob-2
|
||||||
from $(git rev-parse refs/heads/master:file3)
|
from $(git rev-parse refs/heads/master:file3)
|
||||||
data <<EOF
|
data <<EOF
|
||||||
Tag blob by sha1.
|
Tag blob by sha1.
|
||||||
EOF
|
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
|
INPUT_END
|
||||||
|
|
||||||
cat >expect <<EOF
|
cat >expect <<EOF
|
||||||
|
@ -202,12 +222,18 @@ type blob
|
||||||
tag series-A-blob-2
|
tag series-A-blob-2
|
||||||
|
|
||||||
Tag blob by sha1.
|
Tag blob by sha1.
|
||||||
|
object $new_blob
|
||||||
|
type blob
|
||||||
|
tag series-A-blob-3
|
||||||
|
|
||||||
|
Tag new_blob.
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
'A: tag blob by sha1' \
|
'A: tag blob by sha1' \
|
||||||
'git fast-import <input &&
|
'git fast-import <input &&
|
||||||
git cat-file tag tags/series-A-blob-2 >actual &&
|
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_cmp expect actual'
|
||||||
|
|
||||||
test_tick
|
test_tick
|
||||||
|
|
Загрузка…
Ссылка в новой задаче