diff options
Diffstat (limited to 't')
38 files changed, 912 insertions, 181 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index b5ceba4acf..87403da780 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -113,7 +113,8 @@ test_expect_success \ test_expect_success \ 'some edit' \ - 'perl -p -i.orig -e "s/^1A.*\n$//; s/^3A/99/" file && + 'mv file file.orig && + sed -e "s/^3A/99/" -e "/^1A/d" < file.orig > file && GIT_AUTHOR_NAME="D" git commit -a -m "edit"' test_expect_success \ diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index bb1d7b84bc..67d08cf740 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -45,3 +45,6 @@ fi svnrepo="file://$svnrepo" +poke() { + perl -e '@x = stat($ARGV[0]); utime($x[8], $x[9] + 1, $ARGV[0])' "$1" +} diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh index 4f664f6adf..c11420a8b6 100755 --- a/t/t1004-read-tree-m-u-wf.sh +++ b/t/t1004-read-tree-m-u-wf.sh @@ -87,7 +87,7 @@ test_expect_success 'three-way not complaining on an untracked path in both' ' git-read-tree -m -u branch-point master side ' -test_expect_success 'three-way not cloberring a working tree file' ' +test_expect_success 'three-way not clobbering a working tree file' ' git reset --hard && rm -f file2 subdir/file2 file3 subdir/file3 && diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh index c090c96185..1e8f9e59df 100755 --- a/t/t1020-subdirectory.sh +++ b/t/t1020-subdirectory.sh @@ -106,21 +106,21 @@ test_expect_success 'read-tree' ' cmp ../one ../original.one ' -test_expect_success 'no file/rev ambuguity check inside .git' ' +test_expect_success 'no file/rev ambiguity check inside .git' ' cd $HERE && git commit -a -m 1 && cd $HERE/.git && git show -s HEAD ' -test_expect_success 'no file/rev ambuguity check inside a bare repo' ' +test_expect_success 'no file/rev ambiguity check inside a bare repo' ' cd $HERE && git clone -s --bare .git foo.git && cd foo.git && GIT_DIR=. git show -s HEAD ' # This still does not work as it should... -: test_expect_success 'no file/rev ambuguity check inside a bare repo' ' +: test_expect_success 'no file/rev ambiguity check inside a bare repo' ' cd $HERE && git clone -s --bare .git foo.git && cd foo.git && git show -s HEAD diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index eebe643bda..ca2c30f7af 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -101,7 +101,9 @@ echo "Play, play, play" >>hello echo "Lots of fun" >>example git commit -m 'Some fun.' -i hello example -test_expect_failure 'git resolve now fails' 'git resolve HEAD mybranch "Merge work in mybranch"' +test_expect_failure 'git resolve now fails' ' + git merge -m "Merge work in mybranch" mybranch +' cat > hello << EOF Hello World @@ -134,8 +136,8 @@ Updating from VARIABLE to VARIABLE 2 files changed, 2 insertions(+), 0 deletions(-) EOF -git resolve HEAD master "Merge upstream changes." | \ - sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" > resolve.output +git merge -s "Merge upstream changes." master | \ + sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" >resolve.output test_expect_success 'git resolve' 'cmp resolve.expect resolve.output' cat > show-branch2.expect << EOF diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index eb7455ba21..49b5666b33 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -3,13 +3,13 @@ # Copyright (c) 2005 Johannes Schindelin # -test_description='Test git-repo-config in different settings' +test_description='Test git-config in different settings' . ./test-lib.sh test -f .git/config && rm .git/config -git-repo-config core.penguin "little blue" +git-config core.penguin "little blue" cat > expect << EOF [core] @@ -18,7 +18,7 @@ EOF test_expect_success 'initial' 'cmp .git/config expect' -git-repo-config Core.Movie BadPhysics +git-config Core.Movie BadPhysics cat > expect << EOF [core] @@ -28,7 +28,7 @@ EOF test_expect_success 'mixed case' 'cmp .git/config expect' -git-repo-config Cores.WhatEver Second +git-config Cores.WhatEver Second cat > expect << EOF [core] @@ -40,7 +40,7 @@ EOF test_expect_success 'similar section' 'cmp .git/config expect' -git-repo-config CORE.UPPERCASE true +git-config CORE.UPPERCASE true cat > expect << EOF [core] @@ -54,10 +54,10 @@ EOF test_expect_success 'similar section' 'cmp .git/config expect' test_expect_success 'replace with non-match' \ - 'git-repo-config core.penguin kingpin !blue' + 'git-config core.penguin kingpin !blue' test_expect_success 'replace with non-match (actually matching)' \ - 'git-repo-config core.penguin "very blue" !kingpin' + 'git-config core.penguin "very blue" !kingpin' cat > expect << EOF [core] @@ -86,7 +86,7 @@ EOF cp .git/config .git/config2 test_expect_success 'multiple unset' \ - 'git-repo-config --unset-all beta.haha' + 'git-config --unset-all beta.haha' cat > expect << EOF [beta] ; silly comment # another comment @@ -102,7 +102,7 @@ test_expect_success 'multiple unset is correct' 'cmp .git/config expect' mv .git/config2 .git/config test_expect_success '--replace-all' \ - 'git-repo-config --replace-all beta.haha gamma' + 'git-config --replace-all beta.haha gamma' cat > expect << EOF [beta] ; silly comment # another comment @@ -116,7 +116,7 @@ EOF test_expect_success 'all replaced' 'cmp .git/config expect' -git-repo-config beta.haha alpha +git-config beta.haha alpha cat > expect << EOF [beta] ; silly comment # another comment @@ -130,7 +130,7 @@ EOF test_expect_success 'really mean test' 'cmp .git/config expect' -git-repo-config nextsection.nonewline wow +git-config nextsection.nonewline wow cat > expect << EOF [beta] ; silly comment # another comment @@ -145,8 +145,8 @@ EOF test_expect_success 'really really mean test' 'cmp .git/config expect' -test_expect_success 'get value' 'test alpha = $(git-repo-config beta.haha)' -git-repo-config --unset beta.haha +test_expect_success 'get value' 'test alpha = $(git-config beta.haha)' +git-config --unset beta.haha cat > expect << EOF [beta] ; silly comment # another comment @@ -160,7 +160,7 @@ EOF test_expect_success 'unset' 'cmp .git/config expect' -git-repo-config nextsection.NoNewLine "wow2 for me" "for me$" +git-config nextsection.NoNewLine "wow2 for me" "for me$" cat > expect << EOF [beta] ; silly comment # another comment @@ -176,18 +176,18 @@ EOF test_expect_success 'multivar' 'cmp .git/config expect' test_expect_success 'non-match' \ - 'git-repo-config --get nextsection.nonewline !for' + 'git-config --get nextsection.nonewline !for' test_expect_success 'non-match value' \ - 'test wow = $(git-repo-config --get nextsection.nonewline !for)' + 'test wow = $(git-config --get nextsection.nonewline !for)' test_expect_failure 'ambiguous get' \ - 'git-repo-config --get nextsection.nonewline' + 'git-config --get nextsection.nonewline' test_expect_success 'get multivar' \ - 'git-repo-config --get-all nextsection.nonewline' + 'git-config --get-all nextsection.nonewline' -git-repo-config nextsection.nonewline "wow3" "wow$" +git-config nextsection.nonewline "wow3" "wow$" cat > expect << EOF [beta] ; silly comment # another comment @@ -202,15 +202,15 @@ EOF test_expect_success 'multivar replace' 'cmp .git/config expect' -test_expect_failure 'ambiguous value' 'git-repo-config nextsection.nonewline' +test_expect_failure 'ambiguous value' 'git-config nextsection.nonewline' test_expect_failure 'ambiguous unset' \ - 'git-repo-config --unset nextsection.nonewline' + 'git-config --unset nextsection.nonewline' test_expect_failure 'invalid unset' \ - 'git-repo-config --unset somesection.nonewline' + 'git-config --unset somesection.nonewline' -git-repo-config --unset nextsection.nonewline "wow3$" +git-config --unset nextsection.nonewline "wow3$" cat > expect << EOF [beta] ; silly comment # another comment @@ -224,12 +224,12 @@ EOF test_expect_success 'multivar unset' 'cmp .git/config expect' -test_expect_failure 'invalid key' 'git-repo-config inval.2key blabla' +test_expect_failure 'invalid key' 'git-config inval.2key blabla' -test_expect_success 'correct key' 'git-repo-config 123456.a123 987' +test_expect_success 'correct key' 'git-config 123456.a123 987' test_expect_success 'hierarchical section' \ - 'git-repo-config Version.1.2.3eX.Alpha beta' + 'git-config Version.1.2.3eX.Alpha beta' cat > expect << EOF [beta] ; silly comment # another comment @@ -255,7 +255,7 @@ version.1.2.3eX.alpha=beta EOF test_expect_success 'working --list' \ - 'git-repo-config --list > output && cmp output expect' + 'git-config --list > output && cmp output expect' cat > expect << EOF beta.noindent sillyValue @@ -263,9 +263,9 @@ nextsection.nonewline wow2 for me EOF test_expect_success '--get-regexp' \ - 'git-repo-config --get-regexp in > output && cmp output expect' + 'git-config --get-regexp in > output && cmp output expect' -git-repo-config --add nextsection.nonewline "wow4 for you" +git-config --add nextsection.nonewline "wow4 for you" cat > expect << EOF wow2 for me @@ -273,7 +273,7 @@ wow4 for you EOF test_expect_success '--add' \ - 'git-repo-config --get-all nextsection.nonewline > output && cmp output expect' + 'git-config --get-all nextsection.nonewline > output && cmp output expect' cat > .git/config << EOF [novalue] @@ -281,9 +281,9 @@ cat > .git/config << EOF EOF test_expect_success 'get variable with no value' \ - 'git-repo-config --get novalue.variable ^$' + 'git-config --get novalue.variable ^$' -git-repo-config > output 2>&1 +git-config > output 2>&1 test_expect_success 'no arguments, but no crash' \ "test $? = 129 && grep usage output" @@ -293,7 +293,7 @@ cat > .git/config << EOF c = d EOF -git-repo-config a.x y +git-config a.x y cat > expect << EOF [a.b] @@ -304,8 +304,8 @@ EOF test_expect_success 'new section is partial match of another' 'cmp .git/config expect' -git-repo-config b.x y -git-repo-config a.b c +git-config b.x y +git-config a.b c cat > expect << EOF [a.b] @@ -328,11 +328,11 @@ cat > expect << EOF ein.bahn=strasse EOF -GIT_CONFIG=other-config git-repo-config -l > output +GIT_CONFIG=other-config git-config -l > output test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' -GIT_CONFIG=other-config git-repo-config anwohner.park ausweis +GIT_CONFIG=other-config git-config anwohner.park ausweis cat > expect << EOF [ein] @@ -355,7 +355,7 @@ weird EOF test_expect_success "rename section" \ - "git-repo-config --rename-section branch.eins branch.zwei" + "git-config --rename-section branch.eins branch.zwei" cat > expect << EOF # Hallo @@ -371,12 +371,12 @@ EOF test_expect_success "rename succeeded" "diff -u expect .git/config" test_expect_failure "rename non-existing section" \ - 'git-repo-config --rename-section branch."world domination" branch.drei' + 'git-config --rename-section branch."world domination" branch.drei' test_expect_success "rename succeeded" "diff -u expect .git/config" test_expect_success "rename another section" \ - 'git-repo-config --rename-section branch."1 234 blabl/a" branch.drei' + 'git-config --rename-section branch."1 234 blabl/a" branch.drei' cat > expect << EOF # Hallo @@ -393,20 +393,20 @@ test_expect_success "rename succeeded" "diff -u expect .git/config" test_expect_success numbers ' - git-repo-config kilo.gram 1k && - git-repo-config mega.ton 1m && - k=$(git-repo-config --int --get kilo.gram) && + git-config kilo.gram 1k && + git-config mega.ton 1m && + k=$(git-config --int --get kilo.gram) && test z1024 = "z$k" && - m=$(git-repo-config --int --get mega.ton) && + m=$(git-config --int --get mega.ton) && test z1048576 = "z$m" ' rm .git/config -git-repo-config quote.leading " test" -git-repo-config quote.ending "test " -git-repo-config quote.semicolon "test;test" -git-repo-config quote.hash "test#test" +git-config quote.leading " test" +git-config quote.ending "test " +git-config quote.semicolon "test;test" +git-config quote.hash "test#test" cat > expect << EOF [quote] @@ -418,11 +418,31 @@ EOF test_expect_success 'quoting' 'cmp .git/config expect' -test_expect_failure 'key with newline' 'git repo-config key.with\\\ +test_expect_failure 'key with newline' 'git config key.with\\\ newline 123' -test_expect_success 'value with newline' 'git repo-config key.sub value.with\\\ +test_expect_success 'value with newline' 'git config key.sub value.with\\\ newline' +cat > .git/config <<\EOF +[section] + ; comment \ + continued = cont\ +inued + noncont = not continued ; \ + quotecont = "cont;\ +inued" +EOF + +cat > expect <<\EOF +section.continued=continued +section.noncont=not continued +section.quotecont=cont;inued +EOF + +git config --list > result + +test_expect_success 'value continued on next line' 'cmp result expect' + test_done diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index e48e2b7189..d0aba2c2ae 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -93,8 +93,8 @@ rm -rf .git/$m .git/logs expect test_expect_success \ 'enable core.logAllRefUpdates' \ - 'git-repo-config core.logAllRefUpdates true && - test true = $(git-repo-config --bool --get core.logAllRefUpdates)' + 'git-config core.logAllRefUpdates true && + test true = $(git-config --bool --get core.logAllRefUpdates)' test_expect_success \ "create $m (logged by config)" \ diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 0c435f9574..e5bbc384f7 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -20,7 +20,7 @@ check_have () { } check_fsck () { - output=$(git fsck-objects --full) + output=$(git fsck --full) case "$1" in '') test -z "$output" ;; @@ -71,7 +71,7 @@ test_expect_success setup ' check_fsck && chmod +x C && - ( test "`git repo-config --bool core.filemode`" != false || + ( test "`git config --bool core.filemode`" != false || echo executable >>C ) && git add C && test_tick && git commit -m dragon && @@ -96,7 +96,7 @@ test_expect_success setup ' check_have A B C D E F G H I J K L && - git prune --grace=off && + git prune && check_have A B C D E F G H I J K L && @@ -115,7 +115,7 @@ test_expect_success rewind ' check_have A B C D E F G H I J K L && - git prune --grace=off && + git prune && check_have A B C D E F G H I J K L && @@ -160,7 +160,7 @@ test_expect_success 'reflog expire' ' test_expect_success 'prune and fsck' ' - git prune --grace=off && + git prune && check_fsck && check_have A B C D E H L && diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index bb80e4286a..5565c27033 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -94,7 +94,7 @@ test_expect_failure \ git-branch r && git-branch -m q r/q' -git-repo-config branch.s/s.dummy Hello +git-config branch.s/s.dummy Hello test_expect_success \ 'git branch -m s/s s should work when s/t is deleted' \ @@ -107,8 +107,8 @@ test_expect_success \ test -f .git/logs/refs/heads/s' test_expect_success 'config information was renamed, too' \ - "test $(git-repo-config branch.s.dummy) = Hello && - ! git-repo-config branch.s/s/dummy" + "test $(git-config branch.s.dummy) = Hello && + ! git-config branch.s/s/dummy" test_expect_failure \ 'git-branch -m u v should fail when the reflog for u is a symlink' \ diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh index 16bdae4f23..f0c7e22b36 100755 --- a/t/t3210-pack-refs.sh +++ b/t/t3210-pack-refs.sh @@ -96,4 +96,13 @@ test_expect_success \ git-branch -d n/o/p && git-branch n' +test_expect_success 'pack, prune and repack' ' + git-tag foo && + git-pack-refs --all --prune && + git-show-ref >all-of-them && + git-pack-refs && + git-show-ref >again && + diff all-of-them again +' + test_done diff --git a/t/t3700-add.sh b/t/t3700-add.sh index e98786de32..caaab26c2f 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -21,7 +21,7 @@ test_expect_success \ test_expect_success \ 'git-add: Test that executable bit is not used if core.filemode=0' \ - 'git repo-config core.filemode 0 && + 'git config core.filemode 0 && echo foo >xfoo1 && chmod 755 xfoo1 && git-add xfoo1 && @@ -32,7 +32,7 @@ test_expect_success \ test_expect_success \ 'git-update-index --add: Test that executable bit is not used...' \ - 'git repo-config core.filemode 0 && + 'git config core.filemode 0 && echo foo >xfoo2 && chmod 755 xfoo2 && git-update-index --add xfoo2 && @@ -43,7 +43,7 @@ test_expect_success \ test_expect_success \ 'git-update-index --add: Test that executable bit is not used...' \ - 'git repo-config core.filemode 0 && + 'git config core.filemode 0 && ln -s xfoo2 xfoo3 && git-update-index --add xfoo3 && case "`git-ls-files --stage xfoo3`" in diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index ede4d42495..7c7e4335d6 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -172,7 +172,7 @@ EOF check_verify_failure 'verify tag-name check' ############################################################ -# 11. tagger line lable check #1 +# 11. tagger line label check #1 cat >tag.sig <<EOF object $head @@ -187,7 +187,7 @@ EOF check_verify_failure '"tagger" line label check #1' ############################################################ -# 12. tagger line lable check #2 +# 12. tagger line label check #2 cat >tag.sig <<EOF object $head diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index 6714b0dd6e..e54fe0f401 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -29,7 +29,7 @@ test_expect_success 'no encoding header for base case' ' for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H setup" ' - git-repo-config i18n.commitencoding $H && + git-config i18n.commitencoding $H && git-checkout -b $H C0 && echo $H >F && git-commit -a -F ../t3900/$H.txt @@ -44,16 +44,16 @@ do ' done -test_expect_success 'repo-config to remove customization' ' - git-repo-config --unset-all i18n.commitencoding && - if Z=$(git-repo-config --get-all i18n.commitencoding) +test_expect_success 'config to remove customization' ' + git-config --unset-all i18n.commitencoding && + if Z=$(git-config --get-all i18n.commitencoding) then echo Oops, should have failed. false else test z = "z$Z" fi && - git-repo-config i18n.commitencoding utf-8 + git-config i18n.commitencoding utf-8 ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' @@ -67,9 +67,9 @@ do ' done -test_expect_success 'repo-config to add customization' ' - git-repo-config --unset-all i18n.commitencoding && - if Z=$(git-repo-config --get-all i18n.commitencoding) +test_expect_success 'config to add customization' ' + git-config --unset-all i18n.commitencoding && + if Z=$(git-config --get-all i18n.commitencoding) then echo Oops, should have failed. false @@ -81,13 +81,13 @@ test_expect_success 'repo-config to add customization' ' for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H should be shown in itself now" ' - git-repo-config i18n.commitencoding '$H' && + git-config i18n.commitencoding '$H' && compare_with '$H' ../t3900/'$H'.txt ' done -test_expect_success 'repo-config to tweak customization' ' - git-repo-config i18n.logoutputencoding utf-8 +test_expect_success 'config to tweak customization' ' + git-config i18n.logoutputencoding utf-8 ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' @@ -103,7 +103,7 @@ done for J in EUCJP ISO-2022-JP do - git-repo-config i18n.logoutputencoding $J + git-config i18n.logoutputencoding $J for H in EUCJP ISO-2022-JP do test_expect_success "$H should be shown in $J now" ' diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index eda0e2d729..a881797bc7 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -31,7 +31,7 @@ check_encoding () { } test_expect_success setup ' - git-repo-config i18n.commitencoding UTF-8 && + git-config i18n.commitencoding UTF-8 && # use UTF-8 in author and committer name to match the # i18n.commitencoding settings @@ -55,7 +55,7 @@ test_expect_success setup ' git commit -s -m "Second on side" && # the second one on the side branch is ISO-8859-1 - git-repo-config i18n.commitencoding ISO-8859-1 && + git-config i18n.commitencoding ISO-8859-1 && # use author and committer name in ISO-8859-1 to match it. . ../t3901-8859-1.txt && test_tick && @@ -64,11 +64,11 @@ test_expect_success setup ' git commit -s -m "Third on side" && # Back to default - git-repo-config i18n.commitencoding UTF-8 + git-config i18n.commitencoding UTF-8 ' test_expect_success 'format-patch output (ISO-8859-1)' ' - git-repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.logoutputencoding ISO-8859-1 && git format-patch --stdout master..HEAD^ >out-l1 && git format-patch --stdout HEAD^ >out-l2 && @@ -79,7 +79,7 @@ test_expect_success 'format-patch output (ISO-8859-1)' ' ' test_expect_success 'format-patch output (UTF-8)' ' - git repo-config i18n.logoutputencoding UTF-8 && + git config i18n.logoutputencoding UTF-8 && git format-patch --stdout master..HEAD^ >out-u1 && git format-patch --stdout HEAD^ >out-u2 && @@ -91,13 +91,13 @@ test_expect_success 'format-patch output (UTF-8)' ' test_expect_success 'rebase (U/U)' ' # We want the result of rebase in UTF-8 - git-repo-config i18n.commitencoding UTF-8 && + git-config i18n.commitencoding UTF-8 && # The test is about logoutputencoding not affecting the # final outcome -- it is used internally to generate the # patch and the log. - git repo-config i18n.logoutputencoding UTF-8 && + git config i18n.logoutputencoding UTF-8 && # The result will be committed by GIT_COMMITTER_NAME -- # we want UTF-8 encoded name. @@ -109,8 +109,8 @@ test_expect_success 'rebase (U/U)' ' ' test_expect_success 'rebase (U/L)' ' - git-repo-config i18n.commitencoding UTF-8 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding UTF-8 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && git reset --hard side && @@ -121,8 +121,8 @@ test_expect_success 'rebase (U/L)' ' test_expect_success 'rebase (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && git reset --hard side && @@ -134,8 +134,8 @@ test_expect_success 'rebase (L/L)' ' test_expect_success 'rebase (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding UTF-8 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && git reset --hard side && @@ -147,8 +147,8 @@ test_expect_success 'rebase (L/U)' ' test_expect_success 'cherry-pick(U/U)' ' # Both the commitencoding and logoutputencoding is set to UTF-8. - git-repo-config i18n.commitencoding UTF-8 && - git repo-config i18n.logoutputencoding UTF-8 && + git-config i18n.commitencoding UTF-8 && + git config i18n.logoutputencoding UTF-8 && . ../t3901-utf8.txt && git reset --hard master && @@ -162,8 +162,8 @@ test_expect_success 'cherry-pick(U/U)' ' test_expect_success 'cherry-pick(L/L)' ' # Both the commitencoding and logoutputencoding is set to ISO-8859-1 - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && git reset --hard master && @@ -177,8 +177,8 @@ test_expect_success 'cherry-pick(L/L)' ' test_expect_success 'cherry-pick(U/L)' ' # Commitencoding is set to UTF-8 but logoutputencoding is ISO-8859-1 - git-repo-config i18n.commitencoding UTF-8 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding UTF-8 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && git reset --hard master && @@ -193,8 +193,8 @@ test_expect_success 'cherry-pick(L/U)' ' # Again, the commitencoding is set to ISO-8859-1 but # logoutputencoding is set to UTF-8. - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding UTF-8 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && git reset --hard master && @@ -206,8 +206,8 @@ test_expect_success 'cherry-pick(L/U)' ' ' test_expect_success 'rebase --merge (U/U)' ' - git-repo-config i18n.commitencoding UTF-8 && - git repo-config i18n.logoutputencoding UTF-8 && + git-config i18n.commitencoding UTF-8 && + git config i18n.logoutputencoding UTF-8 && . ../t3901-utf8.txt && git reset --hard side && @@ -217,8 +217,8 @@ test_expect_success 'rebase --merge (U/U)' ' ' test_expect_success 'rebase --merge (U/L)' ' - git-repo-config i18n.commitencoding UTF-8 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding UTF-8 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && git reset --hard side && @@ -229,8 +229,8 @@ test_expect_success 'rebase --merge (U/L)' ' test_expect_success 'rebase --merge (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding ISO-8859-1 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && git reset --hard side && @@ -242,8 +242,8 @@ test_expect_success 'rebase --merge (L/L)' ' test_expect_success 'rebase --merge (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. - git-repo-config i18n.commitencoding ISO-8859-1 && - git repo-config i18n.logoutputencoding UTF-8 && + git-config i18n.commitencoding ISO-8859-1 && + git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && git reset --hard side && diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh index 67b9681d36..9c58d77cc2 100755 --- a/t/t4000-diff-format.sh +++ b/t/t4000-diff-format.sh @@ -28,7 +28,7 @@ test_expect_success \ 'git-diff-files -p >current' # that's as far as it comes -if [ "$(git repo-config --get core.filemode)" = false ] +if [ "$(git config --get core.filemode)" = false ] then say 'filemode disabled on the filesystem' test_done diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh index 8ad69d1115..ca342f48a1 100755 --- a/t/t4006-diff-mode.sh +++ b/t/t4006-diff-mode.sh @@ -15,7 +15,7 @@ test_expect_success \ tree=`git-write-tree` && echo $tree' -if [ "$(git repo-config --get core.filemode)" = false ] +if [ "$(git config --get core.filemode)" = false ] then say 'filemode disabled on the filesystem, using update-index --chmod=+x' test_expect_success \ diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index ed37141b6e..3d85ceaae9 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -73,7 +73,7 @@ test_expect_success setup ' for i in 1 2; do echo $i; done >>dir/sub && git update-index file0 dir/sub && - git repo-config log.showroot false && + git config log.showroot false && git commit --amend && git show-branch ' diff --git a/t/t4016-diff-quote.sh b/t/t4016-diff-quote.sh new file mode 100755 index 0000000000..edde8f5568 --- /dev/null +++ b/t/t4016-diff-quote.sh @@ -0,0 +1,66 @@ +#!/bin/sh +# +# Copyright (c) 2007 Junio C Hamano +# + +test_description='Quoting paths in diff output. +' + +. ./test-lib.sh + +P0='pathname' +P1='pathname with HT' +P2='pathname with SP' +P3='pathname +with LF' + +test_expect_success setup ' + echo P0.0 >"$P0.0" && + echo P0.1 >"$P0.1" && + echo P0.2 >"$P0.2" && + echo P0.3 >"$P0.3" && + echo P1.0 >"$P1.0" && + echo P1.2 >"$P1.2" && + echo P1.3 >"$P1.3" && + git add . && + git commit -m initial && + git mv "$P0.0" "R$P0.0" && + git mv "$P0.1" "R$P1.0" && + git mv "$P0.2" "R$P2.0" && + git mv "$P0.3" "R$P3.0" && + git mv "$P1.0" "R$P0.1" && + git mv "$P1.2" "R$P2.1" && + git mv "$P1.3" "R$P3.1" && + : +' + +cat >expect <<\EOF + rename pathname.1 => "Rpathname\twith HT.0" (100%) + rename pathname.3 => "Rpathname\nwith LF.0" (100%) + rename "pathname\twith HT.3" => "Rpathname\nwith LF.1" (100%) + rename pathname.2 => Rpathname with SP.0 (100%) + rename "pathname\twith HT.2" => Rpathname with SP.1 (100%) + rename pathname.0 => Rpathname.0 (100%) + rename "pathname\twith HT.0" => Rpathname.1 (100%) +EOF +test_expect_success 'git diff --summary -M HEAD' ' + git diff --summary -M HEAD >actual && + diff -u expect actual +' + +cat >expect <<\EOF + pathname.1 => "Rpathname\twith HT.0" | 0 + pathname.3 => "Rpathname\nwith LF.0" | 0 + "pathname\twith HT.3" => "Rpathname\nwith LF.1" | 0 + pathname.2 => Rpathname with SP.0 | 0 + "pathname\twith HT.2" => Rpathname with SP.1 | 0 + pathname.0 => Rpathname.0 | 0 + "pathname\twith HT.0" => Rpathname.1 | 0 + 7 files changed, 0 insertions(+), 0 deletions(-) +EOF +test_expect_success 'git diff --stat -M HEAD' ' + git diff --stat -M HEAD >actual && + diff -u expect actual +' + +test_done diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh index 22da6a00cc..b4662b0364 100755 --- a/t/t4102-apply-rename.sh +++ b/t/t4102-apply-rename.sh @@ -31,7 +31,7 @@ test_expect_success setup \ test_expect_success apply \ 'git-apply --index --stat --summary --apply test-patch' -if [ "$(git repo-config --get core.filemode)" = false ] +if [ "$(git config --get core.filemode)" = false ] then say 'filemode disabled on the filesystem' else diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 91be272ac4..c571a1bd74 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -113,8 +113,11 @@ mkdir $rr2 echo Hello > $rr2/preimage case "$(date -d @11111111 +%s 2>/dev/null)" in -[1-9]*) - # it is a recent GNU date. good. +11111111) + # 'date' must be able to take arbitrary input with @11111111 notation. + # for this test to succeed. We should fix this part using more + # portable script someday. + now=$(date +%s) almost_15_days_ago=$(($now+60-15*86400)) just_over_15_days_ago=$(($now-1-15*86400)) @@ -124,30 +127,24 @@ case "$(date -d @11111111 +%s 2>/dev/null)" in predate2="$(date -d "@$almost_15_days_ago" +%Y%m%d%H%M.%S)" postdate1="$(date -d "@$just_over_60_days_ago" +%Y%m%d%H%M.%S)" postdate2="$(date -d "@$just_over_15_days_ago" +%Y%m%d%H%M.%S)" - ;; -*) - # it is not GNU date. oh, well. - predate1="$(date +%Y%m%d%H%M.%S)" - predate2="$(date +%Y%m%d%H%M.%S)" - postdate1='200610010000.00' - postdate2='200612010000.00' -esac -touch -m -t "$predate1" $rr/preimage -touch -m -t "$predate2" $rr2/preimage + touch -m -t "$predate1" $rr/preimage + touch -m -t "$predate2" $rr2/preimage -test_expect_success 'garbage collection (part1)' 'git rerere gc' + test_expect_success 'garbage collection (part1)' 'git rerere gc' -test_expect_success 'young records still live' \ - "test -f $rr/preimage -a -f $rr2/preimage" + test_expect_success 'young records still live' \ + "test -f $rr/preimage -a -f $rr2/preimage" -touch -m -t "$postdate1" $rr/preimage -touch -m -t "$postdate2" $rr2/preimage + touch -m -t "$postdate1" $rr/preimage + touch -m -t "$postdate2" $rr2/preimage -test_expect_success 'garbage collection (part2)' 'git rerere gc' + test_expect_success 'garbage collection (part2)' 'git rerere gc' -test_expect_success 'old records rest in peace' \ - "test ! -f $rr/preimage -a ! -f $rr2/preimage" + test_expect_success 'old records rest in peace' \ + "test ! -f $rr/preimage -a ! -f $rr2/preimage" + ;; +esac test_done diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index cf08e9279c..ac835fe431 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -10,7 +10,7 @@ commit id embedding: The contents of the repository is compared to the extracted tar archive. The repository contains simple text files, symlinks and a - binary file (/bin/sh). Only pathes shorter than 99 characters are + binary file (/bin/sh). Only paths shorter than 99 characters are used. git-tar-tree applies the commit date to every file in the archive it diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index 5a7232a577..a6dbb04a86 100755 --- a/t/t5301-sliding-window.sh +++ b/t/t5301-sliding-window.sh @@ -30,19 +30,19 @@ test_expect_success \ test_expect_success \ 'verify-pack -v, packedGitWindowSize == 1 page' \ - 'git-repo-config core.packedGitWindowSize 512 && + 'git-config core.packedGitWindowSize 512 && git-verify-pack -v "$pack1"' test_expect_success \ 'verify-pack -v, packedGit{WindowSize,Limit} == 1 page' \ - 'git-repo-config core.packedGitWindowSize 512 && - git-repo-config core.packedGitLimit 512 && + 'git-config core.packedGitWindowSize 512 && + git-config core.packedGitLimit 512 && git-verify-pack -v "$pack1"' test_expect_success \ 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' \ - 'git-repo-config core.packedGitWindowSize 512 && - git-repo-config core.packedGitLimit 512 && + 'git-config core.packedGitWindowSize 512 && + git-config core.packedGitLimit 512 && commit2=`git-commit-tree $tree -p $commit1 </dev/null` && git-update-ref HEAD $commit2 && git-repack -a -d && @@ -53,8 +53,8 @@ test_expect_success \ test_expect_success \ 'verify-pack -v, defaults' \ - 'git-repo-config --unset core.packedGitWindowSize && - git-repo-config --unset core.packedGitLimit && + 'git-config --unset core.packedGitWindowSize && + git-config --unset core.packedGitLimit && git-verify-pack -v "$pack2"' test_done diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 2a55d5ae32..7d93d0d7c9 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -55,13 +55,13 @@ test_expect_success setup ' test_expect_success 'pack the source repository' ' git repack -a -d && - git prune --grace=off + git prune ' test_expect_success 'pack the destination repository' ' cd victim && git repack -a -d && - git prune --grace=off && + git prune && cd .. ' @@ -106,7 +106,7 @@ export HOME ;# this way we force the victim/.git/config to be used. test_expect_success \ 'pushing with --force should be denied with denyNonFastforwards' ' cd victim && - git-repo-config receive.denyNonFastforwards true && + git-config receive.denyNonFastforwards true && cd .. && git-update-ref refs/heads/master master^ && git-send-pack --force ./victim/.git/ master && diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index ef78df67ea..48e3d1705f 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -63,13 +63,13 @@ pull_to_client () { case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac git-symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'` - test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1' + test_expect_success "fsck" 'git-fsck --full > fsck.txt 2>&1' test_expect_success 'check downloaded results' \ 'mv .git/objects/pack/pack-* . && p=`ls -1 pack-*.pack` && git-unpack-objects <$p && - git-fsck-objects --full' + git-fsck --full' test_expect_success "new object count after $number pull" \ 'idx=`echo pack-*.idx` && @@ -97,7 +97,8 @@ pull_to_client () { ( mkdir client && cd client && - git-init 2>> log2.txt + git-init 2>> log2.txt && + git config transfer.unpacklimit 0 ) add A1 @@ -144,7 +145,7 @@ test_expect_success "clone shallow object count (part 2)" ' ' test_expect_success "fsck in shallow repo" \ - "(cd shallow; git-fsck-objects --full)" + "(cd shallow; git-fsck --full)" #test_done; exit diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 3ce9446210..50c64856f0 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -22,14 +22,14 @@ test_expect_success "clone and setup child repos" ' cd .. && git clone . two && cd two && - git repo-config branch.master.remote one && - git repo-config remote.one.url ../one/.git/ && - git repo-config remote.one.fetch refs/heads/master:refs/heads/one && + git config branch.master.remote one && + git config remote.one.url ../one/.git/ && + git config remote.one.fetch refs/heads/master:refs/heads/one && cd .. && git clone . three && cd three && - git repo-config branch.master.remote two && - git repo-config branch.master.merge refs/heads/one && + git config branch.master.remote two && + git config branch.master.merge refs/heads/one && mkdir -p .git/remotes && { echo "URL: ../two/.git/" diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh index 041be04f5c..1776b377f3 100755 --- a/t/t5600-clone-fail-cleanup.sh +++ b/t/t5600-clone-fail-cleanup.sh @@ -36,7 +36,7 @@ test_expect_success \ 'git-clone foo bar' test_expect_success \ - 'successfull clone must leave the directory' \ + 'successful clone must leave the directory' \ 'cd bar' test_done diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index ab00e8fb6a..6d43252593 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -22,11 +22,11 @@ echo second > file2 && git add file2 && git commit -m addition && git repack -a -d && -git prune --grace=off' +git prune' cd "$base_dir" -test_expect_success 'cloning with reference' \ +test_expect_success 'cloning with reference (-l -s)' \ 'git clone -l -s --reference B A C' cd "$base_dir" @@ -50,13 +50,35 @@ diff expected current' cd "$base_dir" +test_expect_success 'cloning with reference (no -l -s)' \ +'git clone --reference B A D' + +cd "$base_dir" + +test_expect_success 'existence of info/alternates' \ +'test `wc -l <D/.git/objects/info/alternates` = 1' + +cd "$base_dir" + +test_expect_success 'pulling from reference' \ +'cd D && git pull ../B' + +cd "$base_dir" + +test_expect_success 'that reference gets used' \ +'cd D && echo "0 objects, 0 kilobytes" > expected && +git count-objects > current && +diff expected current' + +cd "$base_dir" + test_expect_success 'updating origin' \ 'cd A && echo third > file3 && git add file3 && git commit -m update && git repack -a -d && -git prune --grace=off' +git prune' cd "$base_dir" @@ -75,4 +97,20 @@ diff expected current' cd "$base_dir" +test_expect_success 'pulling changes from origin' \ +'cd D && +git pull origin' + +cd "$base_dir" + +# the 5 local objects are expected; file3 blob, commit in A to add it +# and its tree, and 2 are our tree and the merge commit. +test_expect_success 'check objects expected to exist locally' \ +'cd D && +echo "5 objects" > expected && +git count-objects | cut -d, -f1 > current && +diff expected current' + +cd "$base_dir" + test_done diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index c30fee81f5..2f8e97cb7e 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -17,7 +17,7 @@ reachable_via() { } test_valid_repo() { - git fsck-objects --full > fsck.log && + git fsck --full > fsck.log && test `wc -l < fsck.log` = 0 } @@ -29,7 +29,7 @@ echo "Hello World" > file1 && git add file1 && git commit -m "Initial commit" file1 && git repack -a -d && -git prune --grace=off' +git prune' cd "$base_dir" @@ -39,7 +39,7 @@ echo "foo bar" > file2 && git add file2 && git commit -m "next commit" file2 && git repack -a -d -l && -git prune --grace=off' +git prune' cd "$base_dir" @@ -49,7 +49,7 @@ echo "Goodbye, cruel world" > file3 && git add file3 && git commit -m "one more" file3 && git repack -a -d -l && -git prune --grace=off' +git prune' cd "$base_dir" diff --git a/t/t6023-merge-rename-nocruft.sh b/t/t6023-merge-rename-nocruft.sh index 69c66cf6fa..65be95fbaa 100755 --- a/t/t6023-merge-rename-nocruft.sh +++ b/t/t6023-merge-rename-nocruft.sh @@ -45,6 +45,7 @@ git add A M && git commit -m "initial has A and M" && git branch white && git branch red && +git branch blue && git checkout white && sed -e "/^g /s/.*/g : white changes a line/" <A >B && @@ -58,6 +59,13 @@ echo created by red >R && git update-index --add R && git commit -m "red creates R" && +git checkout blue && +sed -e "/^o /s/.*/g : blue changes a line/" <A >B && +rm -f A && +mv B A && +git update-index A && +git commit -m "blue modify A" && + git checkout master' # This test broke in 65ac6e9c3f47807cb603af07a6a9e1a43bc119ae @@ -94,4 +102,38 @@ test_expect_success 'merge white into red (A->B,M->N)' \ return 0 ' +# This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9 +test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \ +' + git checkout -b white-blue white && + echo dirty >A && + git merge blue && + git write-tree >/dev/null || { + echo "BAD: merge did not complete" + return 1 + } + + test -f A || { + echo "BAD: A does not exist in working directory" + return 1 + } + test `cat A` = dirty || { + echo "BAD: A content is wrong" + return 1 + } + test -f B || { + echo "BAD: B does not exist in working directory" + return 1 + } + test -f N || { + echo "BAD: N does not exist in working directory" + return 1 + } + test -f M && { + echo "BAD: M still exists in working directory" + return 1 + } + return 0 +' + test_done diff --git a/t/t6200-fmt-merge-msg.sh b/t/t6200-fmt-merge-msg.sh index 63e49f310c..ea14023616 100755 --- a/t/t6200-fmt-merge-msg.sh +++ b/t/t6200-fmt-merge-msg.sh @@ -108,7 +108,7 @@ EOF test_expect_success 'merge-msg test #3' ' - git repo-config merge.summary true && + git config merge.summary true && git checkout master && setdate && @@ -138,7 +138,7 @@ EOF test_expect_success 'merge-msg test #4' ' - git repo-config merge.summary true && + git config merge.summary true && git checkout master && setdate && @@ -150,7 +150,7 @@ test_expect_success 'merge-msg test #4' ' test_expect_success 'merge-msg test #5' ' - git repo-config merge.summary yes && + git config merge.summary yes && git checkout master && setdate && diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 315fa3564c..867bbd26cb 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -100,7 +100,33 @@ test_expect_success "checkout -m with dirty tree, renamed" ' git checkout -m renamer && fill 1 3 4 5 7 8 >expect && diff expect uno && - ! test -f one + ! test -f one && + git diff --cached >current && + ! test -s current + +' + +test_expect_success 'checkout -m with merge conflict' ' + + git checkout -f master && git clean && + + fill 1 T 3 4 5 6 S 8 >one && + if git checkout renamer + then + echo Not happy + false + else + echo "happy - failed correctly" + fi && + + git checkout -m renamer && + + git diff master:one :3:uno | + sed -e "1,/^@@/d" -e "/^ /d" -e "s/^-/d/" -e "s/^+/a/" >current && + fill d2 aT d7 aS >expect && + diff current expect && + git diff --cached two >current && + ! test -s current ' test_done diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 46fcec50a5..e8133d81cb 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -56,11 +56,14 @@ test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc" test_expect_success 'setup some commits to svn' \ 'cd test_wc && echo Greetings >> kw.c && + poke kw.c && svn commit -m "Not yet an Id" && echo Hello world >> kw.c && + poke kw.c && svn commit -m "Modified file, but still not yet an Id" && svn propset svn:keywords Id kw.c && - svn commit -m "Propset Id" + poke kw.c && + svn commit -m "Propset Id" && cd ..' test_expect_success 'initialize git-svn' "git-svn init $svnrepo" @@ -70,7 +73,7 @@ name='test svn:keywords ignoring' test_expect_success "$name" \ 'git checkout -b mybranch remotes/git-svn && echo Hi again >> kw.c && - git commit -a -m "test keywoards ignoring" && + git commit -a -m "test keywords ignoring" && git-svn set-tree remotes/git-svn..mybranch && git pull . remotes/git-svn' @@ -83,7 +86,7 @@ test_expect_success "propset CR on crlf files" \ svn propset svn:eol-style CR empty && svn propset svn:eol-style CR crlf && svn propset svn:eol-style CR ne_crlf && - svn commit -m "propset CR on crlf files" + svn commit -m "propset CR on crlf files" && cd ..' test_expect_success 'fetch and pull latest from svn and checkout a new wc' \ diff --git a/t/t9103-git-svn-graft-branches.sh b/t/t9103-git-svn-graft-branches.sh index 4e55778a47..183ae3b1c2 100755 --- a/t/t9103-git-svn-graft-branches.sh +++ b/t/t9103-git-svn-graft-branches.sh @@ -16,6 +16,7 @@ test_expect_success 'initialize repo' " svn co $svnrepo wc && cd wc && echo feedme >> branches/a/readme && + poke branches/a/readme && svn commit -m hungry && cd trunk && svn merge -r3:4 $svnrepo/branches/a && diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index 8d2e2fec39..405b555368 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -16,11 +16,13 @@ test_expect_success 'initialize repo' " svn co $svnrepo wc && cd wc && echo world >> trunk/readme && + poke trunk/readme && svn commit -m 'another commit' && svn up && svn mv -m 'rename to thunk' trunk thunk && svn up && echo goodbye >> thunk/readme && + poke thunk/readme && svn commit -m 'bye now' && cd .. " diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 59b6425ce4..6f132f2419 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -18,6 +18,7 @@ test_expect_success 'commit change from svn side' " svn co $svnrepo t.svn && cd t.svn && echo second line from svn >> file && + poke file && svn commit -m 'second line from svn' && cd .. && rm -rf t.svn @@ -45,6 +46,7 @@ test_expect_failure 'dcommit fails to commit because of conflict' " svn co $svnrepo t.svn && cd t.svn && echo fourth line from svn >> file && + poke file && svn commit -m 'fourth line from svn' && cd .. && rm -rf t.svn && diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index fd0a5549fe..4efa0c926c 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -169,21 +169,35 @@ test_expect_success \ test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/" )' -# This test contains ISO-8859-1 characters +# Some filesystems mangle pathnames with UTF-8 characters -- +# check and skip +if p="Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö" && + mkdir -p "tst/$p" && + date >"tst/$p/day" && + found=$(find tst -type f -print) && + test "z$found" = "ztst/$p/day" && + rm -fr tst +then + +# This test contains UTF-8 characters test_expect_success \ 'File with non-ascii file name' \ - 'mkdir -p Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö && - echo Foo >Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && - git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.txt && - cp ../test9200a.png Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && - git add Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/gårdetsågårdet.png && - git commit -a -m "Går det så går det" && \ + 'mkdir -p Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö && + echo Foo >Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö/gÃ¥rdetsÃ¥gÃ¥rdet.txt && + git add Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö/gÃ¥rdetsÃ¥gÃ¥rdet.txt && + cp ../test9200a.png Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö/gÃ¥rdetsÃ¥gÃ¥rdet.png && + git add Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö/gÃ¥rdetsÃ¥gÃ¥rdet.png && + git commit -a -m "GÃ¥r det sÃ¥ gÃ¥r det" && \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git-cvsexportcommit -v -c $id && - test "$(echo $(sort Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/" + test "$(echo $(sort Ã…/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/Ã¥/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gÃ¥rdetsÃ¥gÃ¥rdet.png/1.1/-kb gÃ¥rdetsÃ¥gÃ¥rdet.txt/1.1/" )' +fi + +rm -fr tst + test_expect_success \ 'Mismatching patch should fail' \ 'date >>"E/newfile5.txt" && @@ -197,6 +211,10 @@ test_expect_success \ ! git-cvsexportcommit -c $id )' +case "$(git repo-config --bool core.filemode)" in +false) + ;; +*) test_expect_success \ 'Retain execute bit' \ 'mkdir G && @@ -211,5 +229,7 @@ test_expect_success \ test -x G/on && ! test -x G/off )' + ;; +esac test_done diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh new file mode 100755 index 0000000000..970d683650 --- /dev/null +++ b/t/t9300-fast-import.sh @@ -0,0 +1,496 @@ +#!/bin/sh +# +# Copyright (c) 2007 Shawn Pearce +# + +test_description='test git-fast-import utility' +. ./test-lib.sh +. ../diff-lib.sh ;# test-lib chdir's into trash + +file2_data='file2 +second line of EOF' + +file3_data='EOF +in 3rd file + END' + +file4_data=abcd +file4_len=4 + +file5_data='an inline file. + we should see it later.' + +file6_data='#!/bin/sh +echo "$@"' + +### +### series A +### + +test_tick +cat >input <<INPUT_END +blob +mark :2 +data <<EOF +$file2_data +EOF + +blob +mark :3 +data <<END +$file3_data +END + +blob +mark :4 +data $file4_len +$file4_data +commit refs/heads/master +mark :5 +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +initial +COMMIT + +M 644 :2 file2 +M 644 :3 file3 +M 755 :4 file4 + +INPUT_END +test_expect_success \ + 'A: create pack from stdin' \ + 'git-fast-import --export-marks=marks.out <input && + git-whatchanged master' +test_expect_success \ + 'A: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' + +cat >expect <<EOF +author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + +initial +EOF +test_expect_success \ + 'A: verify commit' \ + 'git-cat-file commit master | sed 1d >actual && + diff -u expect actual' + +cat >expect <<EOF +100644 blob file2 +100644 blob file3 +100755 blob file4 +EOF +test_expect_success \ + 'A: verify tree' \ + 'git-cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual && + diff -u expect actual' + +echo "$file2_data" >expect +test_expect_success \ + 'A: verify file2' \ + 'git-cat-file blob master:file2 >actual && diff -u expect actual' + +echo "$file3_data" >expect +test_expect_success \ + 'A: verify file3' \ + 'git-cat-file blob master:file3 >actual && diff -u expect actual' + +printf "$file4_data" >expect +test_expect_success \ + 'A: verify file4' \ + 'git-cat-file blob master:file4 >actual && diff -u expect actual' + +cat >expect <<EOF +:2 `git-rev-parse --verify master:file2` +:3 `git-rev-parse --verify master:file3` +:4 `git-rev-parse --verify master:file4` +:5 `git-rev-parse --verify master^0` +EOF +test_expect_success \ + 'A: verify marks output' \ + 'diff -u expect marks.out' + +### +### series B +### + +test_tick +cat >input <<INPUT_END +commit refs/heads/branch +mark :1 +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +corrupt +COMMIT + +from refs/heads/master +M 755 0000000000000000000000000000000000000001 zero1 + +INPUT_END +test_expect_failure \ + 'B: fail on invalid blob sha1' \ + 'git-fast-import <input' +rm -f .git/objects/pack_* .git/objects/index_* + +### +### series C +### + +newf=`echo hi newf | git-hash-object -w --stdin` +oldf=`git-rev-parse --verify master:file2` +test_tick +cat >input <<INPUT_END +commit refs/heads/branch +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +second +COMMIT + +from refs/heads/master +M 644 $oldf file2/oldf +M 755 $newf file2/newf +D file3 + +INPUT_END +test_expect_success \ + 'C: incremental import create pack from stdin' \ + 'git-fast-import <input && + git-whatchanged branch' +test_expect_success \ + 'C: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' +test_expect_success \ + 'C: validate reuse existing blob' \ + 'test $newf = `git-rev-parse --verify branch:file2/newf` + test $oldf = `git-rev-parse --verify branch:file2/oldf`' + +cat >expect <<EOF +parent `git-rev-parse --verify master^0` +author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + +second +EOF +test_expect_success \ + 'C: verify commit' \ + 'git-cat-file commit branch | sed 1d >actual && + diff -u expect actual' + +cat >expect <<EOF +:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A file2/newf +:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100 file2 file2/oldf +:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D file3 +EOF +git-diff-tree -M -r master branch >actual +test_expect_success \ + 'C: validate rename result' \ + 'compare_diff_raw expect actual' + +### +### series D +### + +test_tick +cat >input <<INPUT_END +commit refs/heads/branch +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +third +COMMIT + +from refs/heads/branch^0 +M 644 inline newdir/interesting +data <<EOF +$file5_data +EOF + +M 755 inline newdir/exec.sh +data <<EOF +$file6_data +EOF + +INPUT_END +test_expect_success \ + 'D: inline data in commit' \ + 'git-fast-import <input && + git-whatchanged branch' +test_expect_success \ + 'D: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' + +cat >expect <<EOF +:000000 100755 0000000000000000000000000000000000000000 35a59026a33beac1569b1c7f66f3090ce9c09afc A newdir/exec.sh +:000000 100644 0000000000000000000000000000000000000000 046d0371e9220107917db0d0e030628de8a1de9b A newdir/interesting +EOF +git-diff-tree -M -r branch^ branch >actual +test_expect_success \ + 'D: validate new files added' \ + 'compare_diff_raw expect actual' + +echo "$file5_data" >expect +test_expect_success \ + 'D: verify file5' \ + 'git-cat-file blob branch:newdir/interesting >actual && + diff -u expect actual' + +echo "$file6_data" >expect +test_expect_success \ + 'D: verify file6' \ + 'git-cat-file blob branch:newdir/exec.sh >actual && + diff -u expect actual' + +### +### series E +### + +cat >input <<INPUT_END +commit refs/heads/branch +author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500 +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500 +data <<COMMIT +RFC 2822 type date +COMMIT + +from refs/heads/branch^0 + +INPUT_END +test_expect_failure \ + 'E: rfc2822 date, --date-format=raw' \ + 'git-fast-import --date-format=raw <input' +test_expect_success \ + 'E: rfc2822 date, --date-format=rfc2822' \ + 'git-fast-import --date-format=rfc2822 <input' +test_expect_success \ + 'E: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' + +cat >expect <<EOF +author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500 +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500 + +RFC 2822 type date +EOF +test_expect_success \ + 'E: verify commit' \ + 'git-cat-file commit branch | sed 1,2d >actual && + diff -u expect actual' + +### +### series F +### + +old_branch=`git-rev-parse --verify branch^0` +test_tick +cat >input <<INPUT_END +commit refs/heads/branch +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +losing things already? +COMMIT + +from refs/heads/branch~1 + +reset refs/heads/other +from refs/heads/branch + +INPUT_END +test_expect_success \ + 'F: non-fast-forward update skips' \ + 'if git-fast-import <input + then + echo BAD gfi did not fail + return 1 + else + if test $old_branch = `git-rev-parse --verify branch^0` + then + : branch unaffected and failure returned + return 0 + else + echo BAD gfi changed branch $old_branch + return 1 + fi + fi + ' +test_expect_success \ + 'F: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' + +cat >expect <<EOF +tree `git-rev-parse branch~1^{tree}` +parent `git-rev-parse branch~1` +author $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + +losing things already? +EOF +test_expect_success \ + 'F: verify other commit' \ + 'git-cat-file commit other >actual && + diff -u expect actual' + +### +### series G +### + +old_branch=`git-rev-parse --verify branch^0` +test_tick +cat >input <<INPUT_END +commit refs/heads/branch +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +losing things already? +COMMIT + +from refs/heads/branch~1 + +INPUT_END +test_expect_success \ + 'G: non-fast-forward update forced' \ + 'git-fast-import --force <input' +test_expect_success \ + 'G: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' +test_expect_success \ + 'G: branch changed, but logged' \ + 'test $old_branch != `git-rev-parse --verify branch^0` && + test $old_branch = `git-rev-parse --verify branch@{1}`' + +### +### series H +### + +test_tick +cat >input <<INPUT_END +commit refs/heads/H +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +third +COMMIT + +from refs/heads/branch^0 +M 644 inline i-will-die +data <<EOF +this file will never exist. +EOF + +deleteall +M 644 inline h/e/l/lo +data <<EOF +$file5_data +EOF + +INPUT_END +test_expect_success \ + 'H: deletall, add 1' \ + 'git-fast-import <input && + git-whatchanged H' +test_expect_success \ + 'H: verify pack' \ + 'for p in .git/objects/pack/*.pack;do git-verify-pack $p||exit;done' + +cat >expect <<EOF +:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D file2/newf +:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D file2/oldf +:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D file4 +:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100 newdir/interesting h/e/l/lo +:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D newdir/exec.sh +EOF +git-diff-tree -M -r H^ H >actual +test_expect_success \ + 'H: validate old files removed, new files added' \ + 'compare_diff_raw expect actual' + +echo "$file5_data" >expect +test_expect_success \ + 'H: verify file' \ + 'git-cat-file blob H:h/e/l/lo >actual && + diff -u expect actual' + +### +### series I +### + +cat >input <<INPUT_END +commit refs/heads/export-boundary +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +we have a border. its only 40 characters wide. +COMMIT + +from refs/heads/branch + +INPUT_END +test_expect_success \ + 'I: export-pack-edges' \ + 'git-fast-import --export-pack-edges=edges.list <input' + +cat >expect <<EOF +.git/objects/pack/pack-.pack: `git-rev-parse --verify export-boundary` +EOF +test_expect_success \ + 'I: verify edge list' \ + 'sed -e s/pack-.*pack/pack-.pack/ edges.list >actual && + diff -u expect actual' + +### +### series J +### + +cat >input <<INPUT_END +commit refs/heads/J +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +create J +COMMIT + +from refs/heads/branch + +reset refs/heads/J + +commit refs/heads/J +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +initialize J +COMMIT + +INPUT_END +test_expect_success \ + 'J: reset existing branch creates empty commit' \ + 'git-fast-import <input' +test_expect_success \ + 'J: branch has 1 commit, empty tree' \ + 'test 1 = `git-rev-list J | wc -l` && + test 0 = `git ls-tree J | wc -l`' + +### +### series K +### + +cat >input <<INPUT_END +commit refs/heads/K +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +create K +COMMIT + +from refs/heads/branch + +commit refs/heads/K +committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE +data <<COMMIT +redo K +COMMIT + +from refs/heads/branch^1 + +INPUT_END +test_expect_success \ + 'K: reinit branch with from' \ + 'git-fast-import <input' +test_expect_success \ + 'K: verify K^1 = branch^1' \ + 'test `git-rev-parse --verify branch^1` \ + = `git-rev-parse --verify K^1`' + +test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index 8e3ee6cd7b..37822fc13d 100755 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -30,6 +30,8 @@ unset GIT_INDEX_FILE unset GIT_OBJECT_DIRECTORY unset SHA1_FILE_DIRECTORIES unset SHA1_FILE_DIRECTORY +GIT_MERGE_VERBOSITY=5 +export GIT_MERGE_VERBOSITY export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME export EDITOR VISUAL |