path: root/t/
diff options
authorElijah Newren <>2018-11-16 07:59:50 (GMT)
committerJunio C Hamano <>2018-11-17 09:43:51 (GMT)
commit1f30c904b38552dccd90135334c342e17a1ed077 (patch)
treee4d3c4c579ec2855fa259f1512c775eddc596d57 /t/
parentb93b81e799ba6a59820821b4ea3afdec1970fbd6 (diff)
fast-export: avoid dying when filtering by paths and old tags exist
If --tag-of-filtered-object=rewrite is specified along with a set of paths to limit what is exported, then any tags pointing to old commits that do not contain any of those specified paths cause problems. Since the old tagged commit is not exported, fast-export attempts to rewrite such tags to an ancestor commit which was exported. If no such commit exists, then fast-export currently die()s. Five years after the tag rewriting logic was added to fast-export (see commit 2d8ad4691921, "fast-export: Add a --tag-of-filtered-object option for newly dangling tags", 2009-06-25), fast-import gained the ability to delete refs (see commit 4ee1b225b99f, "fast-import: add support to delete refs", 2014-04-20), so now we do have a valid option to rewrite the tag to. Delete these tags instead of dying. Signed-off-by: Elijah Newren <> Acked-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 16 insertions, 0 deletions
diff --git a/t/ b/t/
index 6a392e8..3400ebe 100755
--- a/t/
+++ b/t/
@@ -325,6 +325,22 @@ test_expect_success 'rewriting tag of filtered out object' '
+test_expect_success 'rewrite tag predating pathspecs to nothing' '
+ test_create_repo rewrite_tag_predating_pathspecs &&
+ (
+ cd rewrite_tag_predating_pathspecs &&
+ test_commit initial &&
+ git tag -a -m "Some old tag" v0. &&
+ test_commit bar &&
+ git fast-export --tag-of-filtered-object=rewrite --all -- bar.t >output &&
+ grep from.$ZERO_OID output
+ )
cat > limit-by-paths/expected << EOF
mark :1