зеркало из https://github.com/microsoft/git.git
fast-export: handle nested tags
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
8d7d33c1ce
Коммит
941790d7de
|
@ -843,22 +843,28 @@ static void handle_tag(const char *name, struct tag *tag)
|
||||||
free(buf);
|
free(buf);
|
||||||
return;
|
return;
|
||||||
case REWRITE:
|
case REWRITE:
|
||||||
if (tagged->type != OBJ_COMMIT) {
|
if (tagged->type == OBJ_TAG && !mark_tags) {
|
||||||
die("tag %s tags unexported %s!",
|
die(_("Error: Cannot export nested tags unless --mark-tags is specified."));
|
||||||
oid_to_hex(&tag->object.oid),
|
} else if (tagged->type == OBJ_COMMIT) {
|
||||||
type_name(tagged->type));
|
p = rewrite_commit((struct commit *)tagged);
|
||||||
|
if (!p) {
|
||||||
|
printf("reset %s\nfrom %s\n\n",
|
||||||
|
name, oid_to_hex(&null_oid));
|
||||||
|
free(buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tagged_mark = get_object_mark(&p->object);
|
||||||
|
} else {
|
||||||
|
/* tagged->type is either OBJ_BLOB or OBJ_TAG */
|
||||||
|
tagged_mark = get_object_mark(tagged);
|
||||||
}
|
}
|
||||||
p = rewrite_commit((struct commit *)tagged);
|
|
||||||
if (!p) {
|
|
||||||
printf("reset %s\nfrom %s\n\n",
|
|
||||||
name, oid_to_hex(&null_oid));
|
|
||||||
free(buf);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tagged_mark = get_object_mark(&p->object);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tagged->type == OBJ_TAG) {
|
||||||
|
printf("reset %s\nfrom %s\n\n",
|
||||||
|
name, oid_to_hex(&null_oid));
|
||||||
|
}
|
||||||
if (starts_with(name, "refs/tags/"))
|
if (starts_with(name, "refs/tags/"))
|
||||||
name += 10;
|
name += 10;
|
||||||
printf("tag %s\n", name);
|
printf("tag %s\n", name);
|
||||||
|
|
|
@ -567,7 +567,7 @@ test_expect_success 'handling tags of blobs' '
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'handling nested tags' '
|
test_expect_success 'handling nested tags' '
|
||||||
git tag -a -m "This is a nested tag" nested muss &&
|
git tag -a -m "This is a nested tag" nested muss &&
|
||||||
git fast-export --mark-tags nested >output &&
|
git fast-export --mark-tags nested >output &&
|
||||||
grep "^from $ZERO_OID$" output &&
|
grep "^from $ZERO_OID$" output &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче