diff options
author | Elijah Newren <newren@gmail.com> | 2019-10-03 20:27:09 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-03 22:33:21 (GMT) |
commit | 941790d7de6268ba22258bdfb4d0a9ade9390e19 (patch) | |
tree | bcc20e0cd780e9837c237c4cdb8f935e560182e1 /builtin | |
parent | 8d7d33c1ce20066208b68bd75fd6d34e564f7229 (diff) | |
download | git-941790d7de6268ba22258bdfb4d0a9ade9390e19.zip git-941790d7de6268ba22258bdfb4d0a9ade9390e19.tar.gz git-941790d7de6268ba22258bdfb4d0a9ade9390e19.tar.bz2 |
fast-export: handle nested tags
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/fast-export.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c index d32e1e9..58a74de 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -843,22 +843,28 @@ static void handle_tag(const char *name, struct tag *tag) free(buf); return; case REWRITE: - if (tagged->type != OBJ_COMMIT) { - die("tag %s tags unexported %s!", - oid_to_hex(&tag->object.oid), - 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; + if (tagged->type == OBJ_TAG && !mark_tags) { + die(_("Error: Cannot export nested tags unless --mark-tags is specified.")); + } else if (tagged->type == OBJ_COMMIT) { + 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); } - 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/")) name += 10; printf("tag %s\n", name); |