diff options
Diffstat (limited to 't/t9301-fast-export.sh')
-rwxr-xr-x | t/t9301-fast-export.sh | 115 |
1 files changed, 113 insertions, 2 deletions
diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh index f09bfb1117..c19b4a2bab 100755 --- a/t/t9301-fast-export.sh +++ b/t/t9301-fast-export.sh @@ -59,7 +59,7 @@ test_expect_success 'fast-export master~2..master' ' test $MASTER != $(git rev-parse --verify refs/heads/partial) && git diff master..partial && git diff master^..partial^ && - ! git rev-parse partial~2) + test_must_fail git rev-parse partial~2) ' @@ -78,6 +78,29 @@ test_expect_success 'iso-8859-1' ' git cat-file commit i18n | grep "Áéí óú") ' +test_expect_success 'import/export-marks' ' + + git checkout -b marks master && + git fast-export --export-marks=tmp-marks HEAD && + test -s tmp-marks && + test $(wc -l < tmp-marks) -eq 3 && + test $( + git fast-export --import-marks=tmp-marks\ + --export-marks=tmp-marks HEAD | + grep ^commit | + wc -l) \ + -eq 0 && + echo change > file && + git commit -m "last commit" file && + test $( + git fast-export --import-marks=tmp-marks \ + --export-marks=tmp-marks HEAD | + grep ^commit\ | + wc -l) \ + -eq 1 && + test $(wc -l < tmp-marks) -eq 4 + +' cat > signed-tag-import << EOF tag sign-your-name @@ -102,7 +125,7 @@ test_expect_success 'set up faked signed tag' ' test_expect_success 'signed-tags=abort' ' - ! git fast-export --signed-tags=abort sign-your-name + test_must_fail git fast-export --signed-tags=abort sign-your-name ' @@ -120,4 +143,92 @@ test_expect_success 'signed-tags=strip' ' ' +test_expect_success 'setup submodule' ' + + git checkout -f master && + mkdir sub && + cd sub && + git init && + echo test file > file && + git add file && + git commit -m sub_initial && + cd .. && + git submodule add "`pwd`/sub" sub && + git commit -m initial && + test_tick && + cd sub && + echo more data >> file && + git add file && + git commit -m sub_second && + cd .. && + git add sub && + git commit -m second + +' + +test_expect_success 'submodule fast-export | fast-import' ' + + SUBENT1=$(git ls-tree master^ sub) && + SUBENT2=$(git ls-tree master sub) && + rm -rf new && + mkdir new && + git --git-dir=new/.git init && + git fast-export --signed-tags=strip --all | + (cd new && + git fast-import && + test "$SUBENT1" = "$(git ls-tree refs/heads/master^ sub)" && + test "$SUBENT2" = "$(git ls-tree refs/heads/master sub)" && + git checkout master && + git submodule init && + git submodule update && + cmp sub/file ../sub/file) + +' + +export GIT_AUTHOR_NAME='A U Thor' +export GIT_COMMITTER_NAME='C O Mitter' + +test_expect_success 'setup copies' ' + + git config --unset i18n.commitencoding && + git checkout -b copy rein && + git mv file file3 && + git commit -m move1 && + test_tick && + cp file2 file4 && + git add file4 && + git mv file2 file5 && + git commit -m copy1 && + test_tick && + cp file3 file6 && + git add file6 && + git commit -m copy2 && + test_tick && + echo more text >> file6 && + echo even more text >> file6 && + git add file6 && + git commit -m modify && + test_tick && + cp file6 file7 && + echo test >> file7 && + git add file7 && + git commit -m copy_modify + +' + +test_expect_success 'fast-export -C -C | fast-import' ' + + ENTRY=$(git rev-parse --verify copy) && + rm -rf new && + mkdir new && + git --git-dir=new/.git init && + git fast-export -C -C --signed-tags=strip --all > output && + grep "^C \"file6\" \"file7\"\$" output && + cat output | + (cd new && + git fast-import && + test $ENTRY = $(git rev-parse --verify refs/heads/copy)) + +' + test_done |