diff options
Diffstat (limited to 't/t9350-fast-export.sh')
-rwxr-xr-x | t/t9350-fast-export.sh | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index 409b48e..1eb035e 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -236,7 +236,7 @@ EOF test_expect_success 'set up faked signed tag' ' - cat signed-tag-import | git fast-import + git fast-import <signed-tag-import ' @@ -268,6 +268,7 @@ test_expect_success 'signed-tags=warn-strip' ' test_expect_success 'setup submodule' ' + test_config_global protocol.file.allow always && git checkout -f main && mkdir sub && ( @@ -293,6 +294,7 @@ test_expect_success 'setup submodule' ' test_expect_success 'submodule fast-export | fast-import' ' + test_config_global protocol.file.allow always && SUBENT1=$(git ls-tree main^ sub) && SUBENT2=$(git ls-tree main sub) && rm -rf new && @@ -371,7 +373,7 @@ EOF test_expect_success 'cope with tagger-less tags' ' - TAG=$(git hash-object -t tag -w tag-content) && + TAG=$(git hash-object --literally -t tag -w tag-content) && git update-ref refs/tags/sonnenschein $TAG && git fast-export -C -C --signed-tags=strip --all > output && test $(grep -c "^tag " output) = 4 && @@ -500,6 +502,13 @@ test_expect_success 'path limiting with import-marks does not lose unmodified fi grep file0 actual ' +test_expect_success 'path limiting works' ' + git fast-export simple -- file >actual && + sed -ne "s/^M .* //p" <actual | sort -u >actual.files && + echo file >expect && + test_cmp expect actual.files +' + test_expect_success 'avoid corrupt stream with non-existent mark' ' test_create_repo avoid_non_existent_mark && ( @@ -528,7 +537,7 @@ test_expect_success 'full-tree re-shows unmodified files' ' test_expect_success 'set-up a few more tags for tag export tests' ' git checkout -f main && - HEAD_TREE=$(git show -s --pretty=raw HEAD | grep tree | sed "s/tree //") && + HEAD_TREE=$(git show -s --pretty=raw HEAD | sed -n "/tree/s/tree //p") && git tag tree_tag -m "tagging a tree" $HEAD_TREE && git tag -a tree_tag-obj -m "tagging a tree" $HEAD_TREE && git tag tag-obj_tag -m "tagging a tag" tree_tag-obj && @@ -750,4 +759,46 @@ test_expect_success 'merge commit gets exported with --import-marks' ' ) ' + +test_expect_success 'fast-export --first-parent outputs all revisions output by revision walk' ' + git init first-parent && + ( + cd first-parent && + test_commit A && + git checkout -b topic1 && + test_commit B && + git checkout main && + git merge --no-ff topic1 && + + git checkout -b topic2 && + test_commit C && + git checkout main && + git merge --no-ff topic2 && + + test_commit D && + + git fast-export main -- --first-parent >first-parent-export && + git fast-export main -- --first-parent --reverse >first-parent-reverse-export && + test_cmp first-parent-export first-parent-reverse-export && + + git init import && + git -C import fast-import <first-parent-export && + + git log --format="%ad %s" --first-parent main >expected && + git -C import log --format="%ad %s" --all >actual && + test_cmp expected actual && + test_line_count = 4 actual + ) +' + +test_expect_success 'fast-export handles --end-of-options' ' + git update-ref refs/heads/nodash HEAD && + git update-ref refs/heads/--dashes HEAD && + git fast-export --end-of-options nodash >expect && + git fast-export --end-of-options --dashes >actual.raw && + # fix up lines which mention the ref for comparison + sed s/--dashes/nodash/ <actual.raw >actual && + test_cmp expect actual +' + test_done |