diff options
author | Elijah Newren <newren@gmail.com> | 2019-09-24 18:39:58 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-09-28 18:54:40 +0900 |
commit | af2abd870bfe4e95ccac20c721d5edaaa098d7ef (patch) | |
tree | 30573cebd6e42192893c8fb7d4974565128f76c5 /t/t9350-fast-export.sh | |
parent | 4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a (diff) | |
download | git-af2abd870bfe4e95ccac20c721d5edaaa098d7ef.tar.gz |
fast-export: fix exporting a tag and nothing else
fast-export allows specifying revision ranges, which can be used to
export a tag without exporting the commit it tags. fast-export handled
this rather poorly: it would emit a "from :0" directive. Since marks
start at 1 and increase, this means it refers to an unknown commit and
fast-import will choke on the input.
When we are unable to look up a mark for the object being tagged, use a
"from $HASH" directive instead to fix this problem.
Note that this is quite similar to the behavior fast-export exhibits
with commits and parents when --reference-excluded-parents is passed
along with an excluded commit range. For tags of excluded commits we do
not require the --reference-excluded-parents flag because we always have
to tag something. By contrast, when dealing with commits, pruning a
parent is always a viable option, so we need the flag to specify that
parent pruning is not wanted. (It is slightly weird that
--reference-excluded-parents isn't the default with a separate
--prune-excluded-parents flag, but backward compatibility concerns
resulted in the current defaults.)
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9350-fast-export.sh')
-rwxr-xr-x | t/t9350-fast-export.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index b4004e05c2..d32ff41859 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -53,6 +53,19 @@ test_expect_success 'fast-export | fast-import' ' ' +test_expect_success 'fast-export ^muss^{commit} muss' ' + git fast-export --tag-of-filtered-object=rewrite ^muss^{commit} muss >actual && + cat >expected <<-EOF && + tag muss + from $(git rev-parse --verify muss^{commit}) + $(git cat-file tag muss | grep tagger) + data 9 + valentin + + EOF + test_cmp expected actual +' + test_expect_success 'fast-export master~2..master' ' git fast-export master~2..master >actual && |