summaryrefslogtreecommitdiff
path: root/t/t9350-fast-export.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t9350-fast-export.sh')
-rwxr-xr-xt/t9350-fast-export.sh108
1 files changed, 56 insertions, 52 deletions
diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh
index 2e4e214815..409b48e244 100755
--- a/t/t9350-fast-export.sh
+++ b/t/t9350-fast-export.sh
@@ -4,6 +4,9 @@
#
test_description='git fast-export'
+GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
+export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
+
. ./test-lib.sh
test_expect_success 'setup' '
@@ -31,13 +34,13 @@ test_expect_success 'setup' '
git commit -m sitzt file2 &&
test_tick &&
git tag -a -m valentin muss &&
- git merge -s ours master
+ git merge -s ours main
'
test_expect_success 'fast-export | fast-import' '
- MASTER=$(git rev-parse --verify master) &&
+ MAIN=$(git rev-parse --verify main) &&
REIN=$(git rev-parse --verify rein) &&
WER=$(git rev-parse --verify wer) &&
MUSS=$(git rev-parse --verify muss) &&
@@ -46,7 +49,7 @@ test_expect_success 'fast-export | fast-import' '
git fast-export --all >actual &&
(cd new &&
git fast-import &&
- test $MASTER = $(git rev-parse --verify refs/heads/master) &&
+ test $MAIN = $(git rev-parse --verify refs/heads/main) &&
test $REIN = $(git rev-parse --verify refs/tags/rein) &&
test $WER = $(git rev-parse --verify refs/heads/wer) &&
test $MUSS = $(git rev-parse --verify refs/tags/muss)) <actual
@@ -80,35 +83,35 @@ test_expect_success 'fast-export --mark-tags ^muss^{commit} muss' '
test_cmp expected actual
'
-test_expect_success 'fast-export master~2..master' '
+test_expect_success 'fast-export main~2..main' '
- git fast-export master~2..master >actual &&
- sed "s/master/partial/" actual |
+ git fast-export main~2..main >actual &&
+ sed "s/main/partial/" actual |
(cd new &&
git fast-import &&
- test $MASTER != $(git rev-parse --verify refs/heads/partial) &&
- git diff --exit-code master partial &&
- git diff --exit-code master^ partial^ &&
+ test $MAIN != $(git rev-parse --verify refs/heads/partial) &&
+ git diff --exit-code main partial &&
+ git diff --exit-code main^ partial^ &&
test_must_fail git rev-parse partial~2)
'
-test_expect_success 'fast-export --reference-excluded-parents master~2..master' '
+test_expect_success 'fast-export --reference-excluded-parents main~2..main' '
- git fast-export --reference-excluded-parents master~2..master >actual &&
- grep commit.refs/heads/master actual >commit-count &&
+ git fast-export --reference-excluded-parents main~2..main >actual &&
+ grep commit.refs/heads/main actual >commit-count &&
test_line_count = 2 commit-count &&
- sed "s/master/rewrite/" actual |
+ sed "s/main/rewrite/" actual |
(cd new &&
git fast-import &&
- test $MASTER = $(git rev-parse --verify refs/heads/rewrite))
+ test $MAIN = $(git rev-parse --verify refs/heads/rewrite))
'
test_expect_success 'fast-export --show-original-ids' '
- git fast-export --show-original-ids master >output &&
+ git fast-export --show-original-ids main >output &&
grep ^original-oid output| sed -e s/^original-oid.// | sort >actual &&
- git rev-list --objects master muss >objects-and-names &&
+ git rev-list --objects main muss >objects-and-names &&
awk "{print \$1}" objects-and-names | sort >commits-trees-blobs &&
comm -23 actual commits-trees-blobs >unfound &&
test_must_be_empty unfound
@@ -116,8 +119,8 @@ test_expect_success 'fast-export --show-original-ids' '
test_expect_success 'fast-export --show-original-ids | git fast-import' '
- git fast-export --show-original-ids master muss | git fast-import --quiet &&
- test $MASTER = $(git rev-parse --verify refs/heads/master) &&
+ git fast-export --show-original-ids main muss | git fast-import --quiet &&
+ test $MAIN = $(git rev-parse --verify refs/heads/main) &&
test $MUSS = $(git rev-parse --verify refs/tags/muss)
'
@@ -132,12 +135,12 @@ test_expect_success 'reencoding iso-8859-7' '
sed "s/wer/i18n/" iso-8859-7.fi |
(cd new &&
git fast-import &&
- # The commit object, if not re-encoded, would be 240 bytes.
+ # The commit object, if not re-encoded, would be 200 bytes plus hash.
# Removing the "encoding iso-8859-7\n" header drops 20 bytes.
# Re-encoding the Pi character from \xF0 (\360) in iso-8859-7
# to \xCF\x80 (\317\200) in UTF-8 adds a byte. Check for
# the expected size.
- test 221 -eq "$(git cat-file -s i18n)" &&
+ test $(($(test_oid hexsz) + 181)) -eq "$(git cat-file -s i18n)" &&
# ...and for the expected translation of bytes.
git cat-file commit i18n >actual &&
grep $(printf "\317\200") actual &&
@@ -164,12 +167,12 @@ test_expect_success 'preserving iso-8859-7' '
sed "s/wer/i18n-no-recoding/" iso-8859-7.fi |
(cd new &&
git fast-import &&
- # The commit object, if not re-encoded, is 240 bytes.
+ # The commit object, if not re-encoded, is 200 bytes plus hash.
# Removing the "encoding iso-8859-7\n" header would drops 20
# bytes. Re-encoding the Pi character from \xF0 (\360) in
# iso-8859-7 to \xCF\x80 (\317\200) in UTF-8 adds a byte.
# Check for the expected size...
- test 240 -eq "$(git cat-file -s i18n-no-recoding)" &&
+ test $(($(test_oid hexsz) + 200)) -eq "$(git cat-file -s i18n-no-recoding)" &&
# ...as well as the expected byte.
git cat-file commit i18n-no-recoding >actual &&
grep $(printf "\360") actual &&
@@ -192,7 +195,7 @@ test_expect_success 'encoding preserved if reencoding fails' '
grep ^encoding actual &&
# Verify that the commit has the expected size; i.e.
# that no bytes were re-encoded to a different encoding.
- test 252 -eq "$(git cat-file -s i18n-invalid)" &&
+ test $(($(test_oid hexsz) + 212)) -eq "$(git cat-file -s i18n-invalid)" &&
# ...and check for the original special bytes
grep $(printf "\360") actual &&
grep $(printf "\377") actual)
@@ -200,7 +203,7 @@ test_expect_success 'encoding preserved if reencoding fails' '
test_expect_success 'import/export-marks' '
- git checkout -b marks master &&
+ git checkout -b marks main &&
git fast-export --export-marks=tmp-marks HEAD &&
test -s tmp-marks &&
test_line_count = 3 tmp-marks &&
@@ -265,7 +268,7 @@ test_expect_success 'signed-tags=warn-strip' '
test_expect_success 'setup submodule' '
- git checkout -f master &&
+ git checkout -f main &&
mkdir sub &&
(
cd sub &&
@@ -290,17 +293,17 @@ test_expect_success 'setup submodule' '
test_expect_success 'submodule fast-export | fast-import' '
- SUBENT1=$(git ls-tree master^ sub) &&
- SUBENT2=$(git ls-tree master sub) &&
+ SUBENT1=$(git ls-tree main^ sub) &&
+ SUBENT2=$(git ls-tree main sub) &&
rm -rf new &&
mkdir new &&
git --git-dir=new/.git init &&
git fast-export --signed-tags=strip --all >actual &&
(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 &&
+ test "$SUBENT1" = "$(git ls-tree refs/heads/main^ sub)" &&
+ test "$SUBENT2" = "$(git ls-tree refs/heads/main sub)" &&
+ git checkout main &&
git submodule init &&
git submodule update &&
cmp sub/file ../sub/file) <actual
@@ -352,7 +355,7 @@ test_expect_success 'fast-export -C -C | fast-import' '
'
-test_expect_success 'fast-export | fast-import when master is tagged' '
+test_expect_success 'fast-export | fast-import when main is tagged' '
git tag -m msg last &&
git fast-export -C -C --signed-tags=strip --all > output &&
@@ -467,8 +470,8 @@ mark :2
data 3
hi
-reset refs/heads/master
-commit refs/heads/master
+reset refs/heads/main
+commit refs/heads/main
mark :3
author A U Thor <author@example.com> 1112912713 -0700
committer C O Mitter <committer@example.com> 1112912713 -0700
@@ -482,7 +485,7 @@ EOF
test_expect_failure 'no exact-ref revisions included' '
(
cd limit-by-paths &&
- git fast-export master~2..master~1 > output &&
+ git fast-export main~2..main~1 > output &&
test_cmp expected output
)
'
@@ -524,7 +527,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 master &&
+ git checkout -f main &&
HEAD_TREE=$(git show -s --pretty=raw HEAD | grep tree | sed "s/tree //") &&
git tag tree_tag -m "tagging a tree" $HEAD_TREE &&
git tag -a tree_tag-obj -m "tagging a tree" $HEAD_TREE &&
@@ -541,7 +544,7 @@ test_expect_success 'tree_tag' '
# NEEDSWORK: not just check return status, but validate the output
# Note that these tests DO NOTHING other than print a warning that
-# they are ommitting the one tag we asked them to export (because the
+# they are omitting the one tag we asked them to export (because the
# tags resolve to a tree). They exist just to make sure we do not
# abort but instead just warn.
test_expect_success 'tree_tag-obj' 'git fast-export tree_tag-obj'
@@ -549,7 +552,7 @@ test_expect_success 'tag-obj_tag' 'git fast-export tag-obj_tag'
test_expect_success 'tag-obj_tag-obj' 'git fast-export tag-obj_tag-obj'
test_expect_success 'handling tags of blobs' '
- git tag -a -m "Tag of a blob" blobtag $(git rev-parse master:file) &&
+ git tag -a -m "Tag of a blob" blobtag $(git rev-parse main:file) &&
git fast-export blobtag >actual &&
cat >expect <<-EOF &&
blob
@@ -592,17 +595,18 @@ test_expect_success 'directory becomes symlink' '
) &&
(
cd dirtosymlink &&
- git fast-export master -- foo |
+ git fast-export main -- foo |
(cd ../result && git fast-import --quiet)
) &&
- (cd result && git show master:foo)
+ (cd result && git show main:foo)
'
test_expect_success 'fast-export quotes pathnames' '
git init crazy-paths &&
+ test_config -C crazy-paths core.protectNTFS false &&
(cd crazy-paths &&
blob=$(echo foo | git hash-object -w --stdin) &&
- git update-index --add \
+ git -c core.protectNTFS=false update-index --add \
--cacheinfo 100644 $blob "$(printf "path with\\nnewline")" \
--cacheinfo 100644 $blob "path with \"quote\"" \
--cacheinfo 100644 $blob "path with \\backslash" \
@@ -642,7 +646,7 @@ mark :13
data 5
bump
-commit refs/heads/master
+commit refs/heads/main
mark :14
author A U Thor <author@example.com> 1112912773 -0700
committer C O Mitter <committer@example.com> 1112912773 -0700
@@ -656,18 +660,18 @@ EOF
test_expect_success 'avoid uninteresting refs' '
> tmp-marks &&
git fast-export --import-marks=tmp-marks \
- --export-marks=tmp-marks master > /dev/null &&
+ --export-marks=tmp-marks main > /dev/null &&
git tag v1.0 &&
git branch uninteresting &&
echo bump > file &&
git commit -a -m bump &&
git fast-export --import-marks=tmp-marks \
- --export-marks=tmp-marks ^uninteresting ^v1.0 master > actual &&
+ --export-marks=tmp-marks ^uninteresting ^v1.0 main > actual &&
test_cmp expected actual
'
cat > expected << EOF
-reset refs/heads/master
+reset refs/heads/main
from :14
EOF
@@ -675,14 +679,14 @@ EOF
test_expect_success 'refs are updated even if no commits need to be exported' '
> tmp-marks &&
git fast-export --import-marks=tmp-marks \
- --export-marks=tmp-marks master > /dev/null &&
+ --export-marks=tmp-marks main > /dev/null &&
git fast-export --import-marks=tmp-marks \
- --export-marks=tmp-marks master > actual &&
+ --export-marks=tmp-marks main > actual &&
test_cmp expected actual
'
test_expect_success 'use refspec' '
- git fast-export --refspec refs/heads/master:refs/heads/foobar master >actual2 &&
+ git fast-export --refspec refs/heads/main:refs/heads/foobar main >actual2 &&
grep "^commit " actual2 | sort | uniq >actual &&
echo "commit refs/heads/foobar" > expected &&
test_cmp expected actual
@@ -693,7 +697,7 @@ test_expect_success 'delete ref because entire history excluded' '
git fast-export to-delete ^to-delete >actual &&
cat >expected <<-EOF &&
reset refs/heads/to-delete
- from 0000000000000000000000000000000000000000
+ from $ZERO_OID
EOF
test_cmp expected actual
@@ -703,7 +707,7 @@ test_expect_success 'delete refspec' '
git fast-export --refspec :refs/heads/to-delete >actual &&
cat >expected <<-EOF &&
reset refs/heads/to-delete
- from 0000000000000000000000000000000000000000
+ from $ZERO_OID
EOF
test_cmp expected actual
@@ -735,13 +739,13 @@ test_expect_success 'merge commit gets exported with --import-marks' '
test_commit initial &&
git checkout -b topic &&
test_commit on-topic &&
- git checkout master &&
- test_commit on-master &&
+ git checkout main &&
+ test_commit on-main &&
test_tick &&
git merge --no-ff -m Yeah topic &&
echo ":1 $(git rev-parse HEAD^^)" >marks &&
- git fast-export --import-marks=marks master >out &&
+ git fast-export --import-marks=marks main >out &&
grep Yeah out
)
'