зеркало из https://github.com/microsoft/git.git
Merge branch 'di/fast-import-tagging'
* di/fast-import-tagging: fast-import: allow to tag newly created objects fast-import: add tests for tagging blobs
This commit is contained in:
Коммит
0dc691a4f3
|
@ -2726,13 +2726,13 @@ static void parse_new_tag(void)
|
|||
type = oe->type;
|
||||
hashcpy(sha1, oe->idx.sha1);
|
||||
} else if (!get_sha1(from, sha1)) {
|
||||
unsigned long size;
|
||||
char *buf;
|
||||
|
||||
buf = read_sha1_file(sha1, &type, &size);
|
||||
if (!buf || size < 46)
|
||||
die("Not a valid commit: %s", from);
|
||||
free(buf);
|
||||
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();
|
||||
|
|
|
@ -94,6 +94,12 @@ data <<EOF
|
|||
An annotated tag without a tagger
|
||||
EOF
|
||||
|
||||
tag series-A-blob
|
||||
from :3
|
||||
data <<EOF
|
||||
An annotated tag that annotates a blob.
|
||||
EOF
|
||||
|
||||
INPUT_END
|
||||
test_expect_success \
|
||||
'A: create pack from stdin' \
|
||||
|
@ -151,6 +157,18 @@ test_expect_success 'A: verify tag/series-A' '
|
|||
test_cmp expect actual
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
object $(git rev-parse refs/heads/master:file3)
|
||||
type blob
|
||||
tag series-A-blob
|
||||
|
||||
An annotated tag that annotates a blob.
|
||||
EOF
|
||||
test_expect_success 'A: verify tag/series-A-blob' '
|
||||
git cat-file tag tags/series-A-blob >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
cat >expect <<EOF
|
||||
:2 `git rev-parse --verify master:file2`
|
||||
:3 `git rev-parse --verify master:file3`
|
||||
|
@ -169,6 +187,55 @@ test_expect_success \
|
|||
</dev/null &&
|
||||
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
|
||||
object $(git rev-parse refs/heads/master:file3)
|
||||
type blob
|
||||
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
|
||||
cat >input <<INPUT_END
|
||||
commit refs/heads/verify--import-marks
|
||||
|
|
Загрузка…
Ссылка в новой задаче