From: Johannes Sixt Date: Fri, 13 Mar 2009 12:23:26 +0000 (+0100) Subject: test-suite: Make test script numbers unique X-Git-Tag: v1.6.3-rc0~163 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7f733de04e69c8ba40158d1da46c4aa121f714b6;p=git.git test-suite: Make test script numbers unique In order to selectively skip tests, the environment variable GIT_SKIP_TESTS can be set like this: $ GIT_SKIP_TESTS='t1301 t4150.18' make test That is, its value can contain only the test script numbers, but not the full script name. Therefore, it is important that the test scripts are uniquely numbered. This makes it so. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- diff --git a/t/t3409-rebase-hook.sh b/t/t3409-rebase-hook.sh deleted file mode 100755 index 098b75507..000000000 --- a/t/t3409-rebase-hook.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh - -test_description='git rebase with its hook(s)' - -. ./test-lib.sh - -test_expect_success setup ' - echo hello >file && - git add file && - test_tick && - git commit -m initial && - echo goodbye >file && - git add file && - test_tick && - git commit -m second && - git checkout -b side HEAD^ && - echo world >git && - git add git && - test_tick && - git commit -m side && - git checkout master && - git log --pretty=oneline --abbrev-commit --graph --all && - git branch test side -' - -test_expect_success 'rebase' ' - git checkout test && - git reset --hard side && - git rebase master && - test "z$(cat git)" = zworld -' - -test_expect_success 'rebase -i' ' - git checkout test && - git reset --hard side && - EDITOR=true git rebase -i master && - test "z$(cat git)" = zworld -' - -test_expect_success 'setup pre-rebase hook' ' - mkdir -p .git/hooks && - cat >.git/hooks/pre-rebase <.git/PRE-REBASE-INPUT -EOF - chmod +x .git/hooks/pre-rebase -' - -test_expect_success 'pre-rebase hook gets correct input (1)' ' - git checkout test && - git reset --hard side && - git rebase master && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster, - -' - -test_expect_success 'pre-rebase hook gets correct input (2)' ' - git checkout test && - git reset --hard side && - git rebase master test && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test -' - -test_expect_success 'pre-rebase hook gets correct input (3)' ' - git checkout test && - git reset --hard side && - git checkout master && - git rebase master test && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test -' - -test_expect_success 'pre-rebase hook gets correct input (4)' ' - git checkout test && - git reset --hard side && - EDITOR=true git rebase -i master && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster, - -' - -test_expect_success 'pre-rebase hook gets correct input (5)' ' - git checkout test && - git reset --hard side && - EDITOR=true git rebase -i master test && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test -' - -test_expect_success 'pre-rebase hook gets correct input (6)' ' - git checkout test && - git reset --hard side && - git checkout master && - EDITOR=true git rebase -i master test && - test "z$(cat git)" = zworld && - test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test -' - -test_expect_success 'setup pre-rebase hook that fails' ' - mkdir -p .git/hooks && - cat >.git/hooks/pre-rebase <file && + git add file && + test_tick && + git commit -m initial && + echo goodbye >file && + git add file && + test_tick && + git commit -m second && + git checkout -b side HEAD^ && + echo world >git && + git add git && + test_tick && + git commit -m side && + git checkout master && + git log --pretty=oneline --abbrev-commit --graph --all && + git branch test side +' + +test_expect_success 'rebase' ' + git checkout test && + git reset --hard side && + git rebase master && + test "z$(cat git)" = zworld +' + +test_expect_success 'rebase -i' ' + git checkout test && + git reset --hard side && + EDITOR=true git rebase -i master && + test "z$(cat git)" = zworld +' + +test_expect_success 'setup pre-rebase hook' ' + mkdir -p .git/hooks && + cat >.git/hooks/pre-rebase <.git/PRE-REBASE-INPUT +EOF + chmod +x .git/hooks/pre-rebase +' + +test_expect_success 'pre-rebase hook gets correct input (1)' ' + git checkout test && + git reset --hard side && + git rebase master && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster, + +' + +test_expect_success 'pre-rebase hook gets correct input (2)' ' + git checkout test && + git reset --hard side && + git rebase master test && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test +' + +test_expect_success 'pre-rebase hook gets correct input (3)' ' + git checkout test && + git reset --hard side && + git checkout master && + git rebase master test && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test +' + +test_expect_success 'pre-rebase hook gets correct input (4)' ' + git checkout test && + git reset --hard side && + EDITOR=true git rebase -i master && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster, + +' + +test_expect_success 'pre-rebase hook gets correct input (5)' ' + git checkout test && + git reset --hard side && + EDITOR=true git rebase -i master test && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test +' + +test_expect_success 'pre-rebase hook gets correct input (6)' ' + git checkout test && + git reset --hard side && + git checkout master && + EDITOR=true git rebase -i master test && + test "z$(cat git)" = zworld && + test "z$(cat .git/PRE-REBASE-INPUT)" = zmaster,test +' + +test_expect_success 'setup pre-rebase hook that fails' ' + mkdir -p .git/hooks && + cat >.git/hooks/pre-rebase <a && - git add . && - git commit -m first && - echo 2 >b && - git add . && - git commit -a -m second -' - -test_expect_success 'git diff-tree HEAD^ HEAD' ' - git diff-tree --quiet HEAD^ HEAD >cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 0 && test $(wc -l cnt - test $? = 1 && test $(wc -l >b && - echo 3 >c && - git add . && { - git diff-index --quiet --cached HEAD^ >cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l cnt - test $? = 0 && test $(wc -l >c && { - git diff-files --quiet >cnt - test $? = 1 && test $(wc -l cnt - test $? = 1 && test $(wc -l F && - git add F && - git commit -m initial && - echo new line >F && - - test_tick && - git commit -m "This adds some lines to F" F - -' - -test_expect_success 'format normally' ' - - git format-patch --stdout -1 >output && - ! grep Content-Type output - -' - -test_expect_success 'format with signoff without funny signer name' ' - - git format-patch -s --stdout -1 >output && - ! grep Content-Type output - -' - -test_expect_success 'format with non ASCII signer name' ' - - GIT_COMMITTER_NAME="はまの ふにおう" \ - git format-patch -s --stdout -1 >output && - grep Content-Type output - -' - -test_expect_success 'attach and signoff do not duplicate mime headers' ' - - GIT_COMMITTER_NAME="はまの ふにおう" \ - git format-patch -s --stdout -1 --attach >output && - test `grep -ci ^MIME-Version: output` = 1 - -' - -test_done - diff --git a/t/t4035-diff-quiet.sh b/t/t4035-diff-quiet.sh new file mode 100755 index 000000000..e747e8422 --- /dev/null +++ b/t/t4035-diff-quiet.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +test_description='Return value of diffs' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo 1 >a && + git add . && + git commit -m first && + echo 2 >b && + git add . && + git commit -a -m second +' + +test_expect_success 'git diff-tree HEAD^ HEAD' ' + git diff-tree --quiet HEAD^ HEAD >cnt + test $? = 1 && test $(wc -l cnt + test $? = 0 && test $(wc -l cnt + test $? = 1 && test $(wc -l cnt + test $? = 1 && test $(wc -l cnt + test $? = 0 && test $(wc -l cnt + test $? = 0 && test $(wc -l cnt + test $? = 0 && test $(wc -l cnt + test $? = 1 && test $(wc -l >b && + echo 3 >c && + git add . && { + git diff-index --quiet --cached HEAD^ >cnt + test $? = 1 && test $(wc -l cnt + test $? = 1 && test $(wc -l cnt + test $? = 0 && test $(wc -l >c && { + git diff-files --quiet >cnt + test $? = 1 && test $(wc -l cnt + test $? = 1 && test $(wc -l F && + git add F && + git commit -m initial && + echo new line >F && + + test_tick && + git commit -m "This adds some lines to F" F + +' + +test_expect_success 'format normally' ' + + git format-patch --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with signoff without funny signer name' ' + + git format-patch -s --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with non ASCII signer name' ' + + GIT_COMMITTER_NAME="はまの ふにおう" \ + git format-patch -s --stdout -1 >output && + grep Content-Type output + +' + +test_expect_success 'attach and signoff do not duplicate mime headers' ' + + GIT_COMMITTER_NAME="はまの ふにおう" \ + git format-patch -s --stdout -1 --attach >output && + test `grep -ci ^MIME-Version: output` = 1 + +' + +test_done + diff --git a/t/t4203-patch-id.sh b/t/t4203-patch-id.sh deleted file mode 100755 index 04f7bae85..000000000 --- a/t/t4203-patch-id.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -test_description='git patch-id' - -. ./test-lib.sh - -test_expect_success 'setup' ' - test_commit initial foo a && - test_commit first foo b && - git checkout -b same HEAD^ && - test_commit same-msg foo b && - git checkout -b notsame HEAD^ && - test_commit notsame-msg foo c -' - -test_expect_success 'patch-id output is well-formed' ' - git log -p -1 | git patch-id > output && - grep "^[a-f0-9]\{40\} $(git rev-parse HEAD)$" output -' - -get_patch_id () { - git log -p -1 "$1" | git patch-id | - sed "s# .*##" > patch-id_"$1" -} - -test_expect_success 'patch-id detects equality' ' - get_patch_id master && - get_patch_id same && - test_cmp patch-id_master patch-id_same -' - -test_expect_success 'patch-id detects inequality' ' - get_patch_id master && - get_patch_id notsame && - ! test_cmp patch-id_master patch-id_notsame -' - -test_done diff --git a/t/t4204-patch-id.sh b/t/t4204-patch-id.sh new file mode 100755 index 000000000..04f7bae85 --- /dev/null +++ b/t/t4204-patch-id.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +test_description='git patch-id' + +. ./test-lib.sh + +test_expect_success 'setup' ' + test_commit initial foo a && + test_commit first foo b && + git checkout -b same HEAD^ && + test_commit same-msg foo b && + git checkout -b notsame HEAD^ && + test_commit notsame-msg foo c +' + +test_expect_success 'patch-id output is well-formed' ' + git log -p -1 | git patch-id > output && + grep "^[a-f0-9]\{40\} $(git rev-parse HEAD)$" output +' + +get_patch_id () { + git log -p -1 "$1" | git patch-id | + sed "s# .*##" > patch-id_"$1" +} + +test_expect_success 'patch-id detects equality' ' + get_patch_id master && + get_patch_id same && + test_cmp patch-id_master patch-id_same +' + +test_expect_success 'patch-id detects inequality' ' + get_patch_id master && + get_patch_id notsame && + ! test_cmp patch-id_master patch-id_notsame +' + +test_done diff --git a/t/t5521-pull-symlink.sh b/t/t5521-pull-symlink.sh deleted file mode 100755 index 5672b51e2..000000000 --- a/t/t5521-pull-symlink.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -test_description='pulling from symlinked subdir' - -. ./test-lib.sh - -# The scenario we are building: -# -# trash\ directory/ -# clone-repo/ -# subdir/ -# bar -# subdir-link -> clone-repo/subdir/ -# -# The working directory is subdir-link. - -mkdir subdir -echo file >subdir/file -git add subdir/file -git commit -q -m file -git clone -q . clone-repo -ln -s clone-repo/subdir/ subdir-link - - -# Demonstrate that things work if we just avoid the symlink -# -test_expect_success 'pulling from real subdir' ' - ( - echo real >subdir/file && - git commit -m real subdir/file && - cd clone-repo/subdir/ && - git pull && - test real = $(cat file) - ) -' - -# From subdir-link, pulling should work as it does from -# clone-repo/subdir/. -# -# Instead, the error pull gave was: -# -# fatal: 'origin': unable to chdir or not a git archive -# fatal: The remote end hung up unexpectedly -# -# because git would find the .git/config for the "trash directory" -# repo, not for the clone-repo repo. The "trash directory" repo -# had no entry for origin. Git found the wrong .git because -# git rev-parse --show-cdup printed a path relative to -# clone-repo/subdir/, not subdir-link/. Git rev-parse --show-cdup -# used the correct .git, but when the git pull shell script did -# "cd `git rev-parse --show-cdup`", it ended up in the wrong -# directory. A POSIX shell's "cd" works a little differently -# than chdir() in C; "cd -P" is much closer to chdir(). -# -test_expect_success 'pulling from symlinked subdir' ' - ( - echo link >subdir/file && - git commit -m link subdir/file && - cd subdir-link/ && - git pull && - test link = $(cat file) - ) -' - -# Prove that the remote end really is a repo, and other commands -# work fine in this context. It's just that "git pull" breaks. -# -test_expect_success 'pushing from symlinked subdir' ' - ( - cd subdir-link/ && - echo push >file && - git commit -m push ./file && - git push - ) && - test push = $(git show HEAD:subdir/file) -' - -test_done diff --git a/t/t5522-pull-symlink.sh b/t/t5522-pull-symlink.sh new file mode 100755 index 000000000..5672b51e2 --- /dev/null +++ b/t/t5522-pull-symlink.sh @@ -0,0 +1,78 @@ +#!/bin/sh + +test_description='pulling from symlinked subdir' + +. ./test-lib.sh + +# The scenario we are building: +# +# trash\ directory/ +# clone-repo/ +# subdir/ +# bar +# subdir-link -> clone-repo/subdir/ +# +# The working directory is subdir-link. + +mkdir subdir +echo file >subdir/file +git add subdir/file +git commit -q -m file +git clone -q . clone-repo +ln -s clone-repo/subdir/ subdir-link + + +# Demonstrate that things work if we just avoid the symlink +# +test_expect_success 'pulling from real subdir' ' + ( + echo real >subdir/file && + git commit -m real subdir/file && + cd clone-repo/subdir/ && + git pull && + test real = $(cat file) + ) +' + +# From subdir-link, pulling should work as it does from +# clone-repo/subdir/. +# +# Instead, the error pull gave was: +# +# fatal: 'origin': unable to chdir or not a git archive +# fatal: The remote end hung up unexpectedly +# +# because git would find the .git/config for the "trash directory" +# repo, not for the clone-repo repo. The "trash directory" repo +# had no entry for origin. Git found the wrong .git because +# git rev-parse --show-cdup printed a path relative to +# clone-repo/subdir/, not subdir-link/. Git rev-parse --show-cdup +# used the correct .git, but when the git pull shell script did +# "cd `git rev-parse --show-cdup`", it ended up in the wrong +# directory. A POSIX shell's "cd" works a little differently +# than chdir() in C; "cd -P" is much closer to chdir(). +# +test_expect_success 'pulling from symlinked subdir' ' + ( + echo link >subdir/file && + git commit -m link subdir/file && + cd subdir-link/ && + git pull && + test link = $(cat file) + ) +' + +# Prove that the remote end really is a repo, and other commands +# work fine in this context. It's just that "git pull" breaks. +# +test_expect_success 'pushing from symlinked subdir' ' + ( + cd subdir-link/ && + echo push >file && + git commit -m push ./file && + git push + ) && + test push = $(git show HEAD:subdir/file) +' + +test_done diff --git a/t/t6023-merge-rename-nocruft.sh b/t/t6023-merge-rename-nocruft.sh deleted file mode 100755 index 65be95fba..000000000 --- a/t/t6023-merge-rename-nocruft.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh - -test_description='Merge-recursive merging renames' -. ./test-lib.sh - -test_expect_success setup \ -' -cat >A <<\EOF && -a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb -c cccccccccccccccccccccccccccccccccccccccccccccccc -d dddddddddddddddddddddddddddddddddddddddddddddddd -e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee -f ffffffffffffffffffffffffffffffffffffffffffffffff -g gggggggggggggggggggggggggggggggggggggggggggggggg -h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh -i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii -j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj -k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk -l llllllllllllllllllllllllllllllllllllllllllllllll -m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm -n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn -o oooooooooooooooooooooooooooooooooooooooooooooooo -EOF - -cat >M <<\EOF && -A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB -C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC -D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD -E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE -F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG -H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH -I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII -J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ -K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK -L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL -M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM -N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO -EOF - -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/" B && -sed -e "/^G /s/.*/G : colored branch changes a line/" N && -rm -f A M && -git update-index --add --remove A B M N && -git commit -m "white renames A->B, M->N" && - -git checkout red && -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/" 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 -test_expect_success 'merge white into red (A->B,M->N)' \ -' - git checkout -b red-white red && - git merge white && - git write-tree >/dev/null || { - echo "BAD: merge did not complete" - 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 R || { - echo "BAD: R does not exist in working directory" - return 1 - } - - test -f A && { - echo "BAD: A still exists in working directory" - return 1 - } - test -f M && { - echo "BAD: M still exists in working directory" - return 1 - } - 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/t6034-merge-rename-nocruft.sh b/t/t6034-merge-rename-nocruft.sh new file mode 100755 index 000000000..65be95fba --- /dev/null +++ b/t/t6034-merge-rename-nocruft.sh @@ -0,0 +1,139 @@ +#!/bin/sh + +test_description='Merge-recursive merging renames' +. ./test-lib.sh + +test_expect_success setup \ +' +cat >A <<\EOF && +a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +b bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +c cccccccccccccccccccccccccccccccccccccccccccccccc +d dddddddddddddddddddddddddddddddddddddddddddddddd +e eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +f ffffffffffffffffffffffffffffffffffffffffffffffff +g gggggggggggggggggggggggggggggggggggggggggggggggg +h hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +i iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii +j jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj +k kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk +l llllllllllllllllllllllllllllllllllllllllllllllll +m mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm +n nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn +o oooooooooooooooooooooooooooooooooooooooooooooooo +EOF + +cat >M <<\EOF && +A AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +B BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB +C CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC +D DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD +E EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +F FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +G GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG +H HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH +I IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII +J JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ +K KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK +L LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL +M MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +N NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN +O OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO +EOF + +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/" B && +sed -e "/^G /s/.*/G : colored branch changes a line/" N && +rm -f A M && +git update-index --add --remove A B M N && +git commit -m "white renames A->B, M->N" && + +git checkout red && +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/" 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 +test_expect_success 'merge white into red (A->B,M->N)' \ +' + git checkout -b red-white red && + git merge white && + git write-tree >/dev/null || { + echo "BAD: merge did not complete" + 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 R || { + echo "BAD: R does not exist in working directory" + return 1 + } + + test -f A && { + echo "BAD: A still exists in working directory" + return 1 + } + test -f M && { + echo "BAD: M still exists in working directory" + return 1 + } + 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/t7502-status.sh b/t/t7502-status.sh deleted file mode 100755 index 93f875f50..000000000 --- a/t/t7502-status.sh +++ /dev/null @@ -1,400 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007 Johannes E. Schindelin -# - -test_description='git status' - -. ./test-lib.sh - -test_expect_success 'setup' ' - : > tracked && - : > modified && - mkdir dir1 && - : > dir1/tracked && - : > dir1/modified && - mkdir dir2 && - : > dir1/tracked && - : > dir1/modified && - git add . && - - git status >output && - - test_tick && - git commit -m initial && - : > untracked && - : > dir1/untracked && - : > dir2/untracked && - echo 1 > dir1/modified && - echo 2 > dir2/modified && - echo 3 > dir2/added && - git add dir2/added -' - -test_expect_success 'status (1)' ' - - grep "use \"git rm --cached \.\.\.\" to unstage" output - -' - -cat > expect << \EOF -# On branch master -# Changes to be committed: -# (use "git reset HEAD ..." to unstage) -# -# new file: dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -EOF - -test_expect_success 'status (2)' ' - - git status > output && - test_cmp expect output - -' - -cat >expect <..." to unstage) -# -# new file: dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files not listed (use -u option to show untracked files) -EOF -test_expect_success 'status -uno' ' - mkdir dir3 && - : > dir3/untracked1 && - : > dir3/untracked2 && - git status -uno >output && - test_cmp expect output -' - -test_expect_success 'status (status.showUntrackedFiles no)' ' - git config status.showuntrackedfiles no - git status >output && - test_cmp expect output -' - -cat >expect <..." to unstage) -# -# new file: dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# dir3/ -# expect -# output -# untracked -EOF -test_expect_success 'status -unormal' ' - git status -unormal >output && - test_cmp expect output -' - -test_expect_success 'status (status.showUntrackedFiles normal)' ' - git config status.showuntrackedfiles normal - git status >output && - test_cmp expect output -' - -cat >expect <..." to unstage) -# -# new file: dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# dir3/untracked1 -# dir3/untracked2 -# expect -# output -# untracked -EOF -test_expect_success 'status -uall' ' - git status -uall >output && - test_cmp expect output -' -test_expect_success 'status (status.showUntrackedFiles all)' ' - git config status.showuntrackedfiles all - git status >output && - rm -rf dir3 && - git config --unset status.showuntrackedfiles && - test_cmp expect output -' - -cat > expect << \EOF -# On branch master -# Changes to be committed: -# (use "git reset HEAD ..." to unstage) -# -# new file: ../dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# untracked -# ../dir2/modified -# ../dir2/untracked -# ../expect -# ../output -# ../untracked -EOF - -test_expect_success 'status with relative paths' ' - - (cd dir1 && git status) > output && - test_cmp expect output - -' - -cat > expect << \EOF -# On branch master -# Changes to be committed: -# (use "git reset HEAD ..." to unstage) -# -# new file: dir2/added -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -EOF - -test_expect_success 'status without relative paths' ' - - git config status.relativePaths false - (cd dir1 && git status) > output && - test_cmp expect output - -' - -cat <expect -# On branch master -# Changes to be committed: -# (use "git reset HEAD ..." to unstage) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/ -# expect -# output -# untracked -EOF -test_expect_success 'status of partial commit excluding new file in index' ' - git status dir1/modified >output && - test_cmp expect output -' - -test_expect_success 'setup status submodule summary' ' - test_create_repo sm && ( - cd sm && - >foo && - git add foo && - git commit -m "Add foo" - ) && - git add sm -' - -cat >expect <..." to unstage) -# -# new file: dir2/added -# new file: sm -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -EOF -test_expect_success 'status submodule summary is disabled by default' ' - git status >output && - test_cmp expect output -' - -# we expect the same as the previous test -test_expect_success 'status --untracked-files=all does not show submodule' ' - git status --untracked-files=all >output && - test_cmp expect output -' - -head=$(cd sm && git rev-parse --short=7 --verify HEAD) - -cat >expect <..." to unstage) -# -# new file: dir2/added -# new file: sm -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Modified submodules: -# -# * sm 0000000...$head (1): -# > Add foo -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -EOF -test_expect_success 'status submodule summary' ' - git config status.submodulesummary 10 && - git status >output && - test_cmp expect output -' - - -cat >expect <..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -no changes added to commit (use "git add" and/or "git commit -a") -EOF -test_expect_success 'status submodule summary (clean submodule)' ' - git commit -m "commit submodule" && - git config status.submodulesummary 10 && - test_must_fail git status >output && - test_cmp expect output -' - -cat >expect <..." to unstage) -# -# new file: dir2/added -# new file: sm -# -# Changed but not updated: -# (use "git add ..." to update what will be committed) -# (use "git checkout -- ..." to discard changes in working directory) -# -# modified: dir1/modified -# -# Modified submodules: -# -# * sm 0000000...$head (1): -# > Add foo -# -# Untracked files: -# (use "git add ..." to include in what will be committed) -# -# dir1/untracked -# dir2/modified -# dir2/untracked -# expect -# output -# untracked -EOF -test_expect_success 'status submodule summary (--amend)' ' - git config status.submodulesummary 10 && - git status --amend >output && - test_cmp expect output -' - -test_done diff --git a/t/t7508-status.sh b/t/t7508-status.sh new file mode 100755 index 000000000..93f875f50 --- /dev/null +++ b/t/t7508-status.sh @@ -0,0 +1,400 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git status' + +. ./test-lib.sh + +test_expect_success 'setup' ' + : > tracked && + : > modified && + mkdir dir1 && + : > dir1/tracked && + : > dir1/modified && + mkdir dir2 && + : > dir1/tracked && + : > dir1/modified && + git add . && + + git status >output && + + test_tick && + git commit -m initial && + : > untracked && + : > dir1/untracked && + : > dir2/untracked && + echo 1 > dir1/modified && + echo 2 > dir2/modified && + echo 3 > dir2/added && + git add dir2/added +' + +test_expect_success 'status (1)' ' + + grep "use \"git rm --cached \.\.\.\" to unstage" output + +' + +cat > expect << \EOF +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF + +test_expect_success 'status (2)' ' + + git status > output && + test_cmp expect output + +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files not listed (use -u option to show untracked files) +EOF +test_expect_success 'status -uno' ' + mkdir dir3 && + : > dir3/untracked1 && + : > dir3/untracked2 && + git status -uno >output && + test_cmp expect output +' + +test_expect_success 'status (status.showUntrackedFiles no)' ' + git config status.showuntrackedfiles no + git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# dir3/ +# expect +# output +# untracked +EOF +test_expect_success 'status -unormal' ' + git status -unormal >output && + test_cmp expect output +' + +test_expect_success 'status (status.showUntrackedFiles normal)' ' + git config status.showuntrackedfiles normal + git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# dir3/untracked1 +# dir3/untracked2 +# expect +# output +# untracked +EOF +test_expect_success 'status -uall' ' + git status -uall >output && + test_cmp expect output +' +test_expect_success 'status (status.showUntrackedFiles all)' ' + git config status.showuntrackedfiles all + git status >output && + rm -rf dir3 && + git config --unset status.showuntrackedfiles && + test_cmp expect output +' + +cat > expect << \EOF +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# new file: ../dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# untracked +# ../dir2/modified +# ../dir2/untracked +# ../expect +# ../output +# ../untracked +EOF + +test_expect_success 'status with relative paths' ' + + (cd dir1 && git status) > output && + test_cmp expect output + +' + +cat > expect << \EOF +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF + +test_expect_success 'status without relative paths' ' + + git config status.relativePaths false + (cd dir1 && git status) > output && + test_cmp expect output + +' + +cat <expect +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/ +# expect +# output +# untracked +EOF +test_expect_success 'status of partial commit excluding new file in index' ' + git status dir1/modified >output && + test_cmp expect output +' + +test_expect_success 'setup status submodule summary' ' + test_create_repo sm && ( + cd sm && + >foo && + git add foo && + git commit -m "Add foo" + ) && + git add sm +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary is disabled by default' ' + git status >output && + test_cmp expect output +' + +# we expect the same as the previous test +test_expect_success 'status --untracked-files=all does not show submodule' ' + git status --untracked-files=all >output && + test_cmp expect output +' + +head=$(cd sm && git rev-parse --short=7 --verify HEAD) + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary' ' + git config status.submodulesummary 10 && + git status >output && + test_cmp expect output +' + + +cat >expect <..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +no changes added to commit (use "git add" and/or "git commit -a") +EOF +test_expect_success 'status submodule summary (clean submodule)' ' + git commit -m "commit submodule" && + git config status.submodulesummary 10 && + test_must_fail git status >output && + test_cmp expect output +' + +cat >expect <..." to unstage) +# +# new file: dir2/added +# new file: sm +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# (use "git checkout -- ..." to discard changes in working directory) +# +# modified: dir1/modified +# +# Modified submodules: +# +# * sm 0000000...$head (1): +# > Add foo +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF +test_expect_success 'status submodule summary (--amend)' ' + git config status.submodulesummary 10 && + git status --amend >output && + test_cmp expect output +' + +test_done diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh deleted file mode 100755 index fd185011b..000000000 --- a/t/t9106-git-svn-dcommit-clobber-series.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007 Eric Wong -test_description='git svn dcommit clobber series' -. ./lib-git-svn.sh - -test_expect_success 'initialize repo' ' - mkdir import && - cd import && - awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file - svn import -m "initial" . "$svnrepo" && - cd .. && - git svn init "$svnrepo" && - git svn fetch && - test -e file - ' - -test_expect_success '(supposedly) non-conflicting change from SVN' ' - test x"`sed -n -e 58p < file`" = x58 && - test x"`sed -n -e 61p < file`" = x61 && - svn co "$svnrepo" tmp && - cd tmp && - perl -i.bak -p -e "s/^58$/5588/" file && - perl -i.bak -p -e "s/^61$/6611/" file && - poke file && - test x"`sed -n -e 58p < file`" = x5588 && - test x"`sed -n -e 61p < file`" = x6611 && - svn commit -m "58 => 5588, 61 => 6611" && - cd .. - ' - -test_expect_success 'some unrelated changes to git' " - echo hi > life && - git update-index --add life && - git commit -m hi-life && - echo bye >> life && - git commit -m bye-life life - " - -test_expect_success 'change file but in unrelated area' " - test x\"\`sed -n -e 4p < file\`\" = x4 && - test x\"\`sed -n -e 7p < file\`\" = x7 && - perl -i.bak -p -e 's/^4\$/4444/' file && - perl -i.bak -p -e 's/^7\$/7777/' file && - test x\"\`sed -n -e 4p < file\`\" = x4444 && - test x\"\`sed -n -e 7p < file\`\" = x7777 && - git commit -m '4 => 4444, 7 => 7777' file && - git svn dcommit && - svn up tmp && - cd tmp && - test x\"\`sed -n -e 4p < file\`\" = x4444 && - test x\"\`sed -n -e 7p < file\`\" = x7777 && - test x\"\`sed -n -e 58p < file\`\" = x5588 && - test x\"\`sed -n -e 61p < file\`\" = x6611 - " - -test_expect_success 'attempt to dcommit with a dirty index' ' - echo foo >>file && - git add file && - test_must_fail git svn dcommit -' - -test_done diff --git a/t/t9108-git-svn-multi-glob.sh b/t/t9108-git-svn-multi-glob.sh deleted file mode 100755 index 8f79c3f25..000000000 --- a/t/t9108-git-svn-multi-glob.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -# Copyright (c) 2007 Eric Wong -test_description='git svn globbing refspecs' -. ./lib-git-svn.sh - -cat > expect.end < trunk/src/a/readme && - echo "goodbye world" > trunk/src/b/readme && - svn import -m "initial" trunk "$svnrepo"/trunk && - svn co "$svnrepo" tmp && - ( - cd tmp && - mkdir branches branches/v1 tags && - svn add branches tags && - svn cp trunk branches/v1/start && - svn commit -m "start a new branch" && - svn up && - echo "hi" >> branches/v1/start/src/b/readme && - poke branches/v1/start/src/b/readme && - echo "hey" >> branches/v1/start/src/a/readme && - poke branches/v1/start/src/a/readme && - svn commit -m "hi" && - svn up && - svn cp branches/v1/start tags/end && - echo "bye" >> tags/end/src/b/readme && - poke tags/end/src/b/readme && - echo "aye" >> tags/end/src/a/readme && - poke tags/end/src/a/readme && - svn commit -m "the end" && - echo "byebye" >> tags/end/src/b/readme && - poke tags/end/src/b/readme && - svn commit -m "nothing to see here" - ) && - git config --add svn-remote.svn.url "$svnrepo" && - git config --add svn-remote.svn.fetch \ - "trunk/src/a:refs/remotes/trunk" && - git config --add svn-remote.svn.branches \ - "branches/*/*/src/a:refs/remotes/branches/*/*" && - git config --add svn-remote.svn.tags\ - "tags/*/src/a:refs/remotes/tags/*" && - git svn multi-fetch && - git log --pretty=oneline refs/remotes/tags/end | \ - sed -e "s/^.\{41\}//" > output.end && - test_cmp expect.end output.end && - test "`git rev-parse refs/remotes/tags/end~1`" = \ - "`git rev-parse refs/remotes/branches/v1/start`" && - test "`git rev-parse refs/remotes/branches/v1/start~2`" = \ - "`git rev-parse refs/remotes/trunk`" && - test_must_fail git rev-parse refs/remotes/tags/end@3 - ' - -echo try to try > expect.two -echo nothing to see here >> expect.two -cat expect.end >> expect.two - -test_expect_success 'test left-hand-side only globbing' ' - git config --add svn-remote.two.url "$svnrepo" && - git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk && - git config --add svn-remote.two.branches \ - "branches/*/*:refs/remotes/two/branches/*/*" && - git config --add svn-remote.two.tags \ - "tags/*:refs/remotes/two/tags/*" && - ( - cd tmp && - echo "try try" >> tags/end/src/b/readme && - poke tags/end/src/b/readme && - svn commit -m "try to try" - ) && - git svn fetch two && - test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 && - test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 && - test `git rev-parse refs/remotes/two/branches/v1/start~2` = \ - `git rev-parse refs/remotes/two/trunk` && - test `git rev-parse refs/remotes/two/tags/end~3` = \ - `git rev-parse refs/remotes/two/branches/v1/start` && - git log --pretty=oneline refs/remotes/two/tags/end | \ - sed -e "s/^.\{41\}//" > output.two && - test_cmp expect.two output.two - ' -cat > expect.four <> branches/v2/start/src/b/readme && - poke branches/v2/start/src/b/readme && - echo "howdy" >> branches/v2/start/src/a/readme && - poke branches/v2/start/src/a/readme && - svn commit -m "Changed 2 in v2/start" && - svn up && - svn cp branches/v2/start tags/next && - echo "bye" >> tags/next/src/b/readme && - poke tags/next/src/b/readme && - echo "aye" >> tags/next/src/a/readme && - poke tags/next/src/a/readme && - svn commit -m "adding more" && - echo "byebye" >> tags/next/src/b/readme && - poke tags/next/src/b/readme && - svn commit -m "adios" - ) && - git config --add svn-remote.four.url "$svnrepo" && - git config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk && - git config --add svn-remote.four.branches \ - "branches/*/*:refs/remotes/four/branches/*/*" && - git config --add svn-remote.four.tags \ - "tags/*:refs/remotes/four/tags/*" && - git svn fetch four && - test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 && - test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 && - test `git rev-parse refs/remotes/four/branches/v2/start~2` = \ - `git rev-parse refs/remotes/four/trunk` && - test `git rev-parse refs/remotes/four/tags/next~2` = \ - `git rev-parse refs/remotes/four/branches/v2/start` && - git log --pretty=oneline refs/remotes/four/tags/next | \ - sed -e "s/^.\{41\}//" > output.four && - test_cmp expect.four output.four - ' - -echo "Only one set of wildcard directories" \ - "(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three -echo "" >> expect.three - -test_expect_success 'test disallow multiple globs' ' - git config --add svn-remote.three.url "$svnrepo" && - git config --add svn-remote.three.fetch \ - trunk:refs/remotes/three/trunk && - git config --add svn-remote.three.branches \ - "branches/*/t/*:refs/remotes/three/branches/*/*" && - git config --add svn-remote.three.tags \ - "tags/*:refs/remotes/three/tags/*" && - ( - cd tmp && - echo "try try" >> tags/end/src/b/readme && - poke tags/end/src/b/readme && - svn commit -m "try to try" - ) && - test_must_fail git svn fetch three 2> stderr.three && - test_cmp expect.three stderr.three - ' - -test_done diff --git a/t/t9109-git-svn-multi-glob.sh b/t/t9109-git-svn-multi-glob.sh new file mode 100755 index 000000000..8f79c3f25 --- /dev/null +++ b/t/t9109-git-svn-multi-glob.sh @@ -0,0 +1,160 @@ +#!/bin/sh +# Copyright (c) 2007 Eric Wong +test_description='git svn globbing refspecs' +. ./lib-git-svn.sh + +cat > expect.end < trunk/src/a/readme && + echo "goodbye world" > trunk/src/b/readme && + svn import -m "initial" trunk "$svnrepo"/trunk && + svn co "$svnrepo" tmp && + ( + cd tmp && + mkdir branches branches/v1 tags && + svn add branches tags && + svn cp trunk branches/v1/start && + svn commit -m "start a new branch" && + svn up && + echo "hi" >> branches/v1/start/src/b/readme && + poke branches/v1/start/src/b/readme && + echo "hey" >> branches/v1/start/src/a/readme && + poke branches/v1/start/src/a/readme && + svn commit -m "hi" && + svn up && + svn cp branches/v1/start tags/end && + echo "bye" >> tags/end/src/b/readme && + poke tags/end/src/b/readme && + echo "aye" >> tags/end/src/a/readme && + poke tags/end/src/a/readme && + svn commit -m "the end" && + echo "byebye" >> tags/end/src/b/readme && + poke tags/end/src/b/readme && + svn commit -m "nothing to see here" + ) && + git config --add svn-remote.svn.url "$svnrepo" && + git config --add svn-remote.svn.fetch \ + "trunk/src/a:refs/remotes/trunk" && + git config --add svn-remote.svn.branches \ + "branches/*/*/src/a:refs/remotes/branches/*/*" && + git config --add svn-remote.svn.tags\ + "tags/*/src/a:refs/remotes/tags/*" && + git svn multi-fetch && + git log --pretty=oneline refs/remotes/tags/end | \ + sed -e "s/^.\{41\}//" > output.end && + test_cmp expect.end output.end && + test "`git rev-parse refs/remotes/tags/end~1`" = \ + "`git rev-parse refs/remotes/branches/v1/start`" && + test "`git rev-parse refs/remotes/branches/v1/start~2`" = \ + "`git rev-parse refs/remotes/trunk`" && + test_must_fail git rev-parse refs/remotes/tags/end@3 + ' + +echo try to try > expect.two +echo nothing to see here >> expect.two +cat expect.end >> expect.two + +test_expect_success 'test left-hand-side only globbing' ' + git config --add svn-remote.two.url "$svnrepo" && + git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk && + git config --add svn-remote.two.branches \ + "branches/*/*:refs/remotes/two/branches/*/*" && + git config --add svn-remote.two.tags \ + "tags/*:refs/remotes/two/tags/*" && + ( + cd tmp && + echo "try try" >> tags/end/src/b/readme && + poke tags/end/src/b/readme && + svn commit -m "try to try" + ) && + git svn fetch two && + test `git rev-list refs/remotes/two/tags/end | wc -l` -eq 6 && + test `git rev-list refs/remotes/two/branches/v1/start | wc -l` -eq 3 && + test `git rev-parse refs/remotes/two/branches/v1/start~2` = \ + `git rev-parse refs/remotes/two/trunk` && + test `git rev-parse refs/remotes/two/tags/end~3` = \ + `git rev-parse refs/remotes/two/branches/v1/start` && + git log --pretty=oneline refs/remotes/two/tags/end | \ + sed -e "s/^.\{41\}//" > output.two && + test_cmp expect.two output.two + ' +cat > expect.four <> branches/v2/start/src/b/readme && + poke branches/v2/start/src/b/readme && + echo "howdy" >> branches/v2/start/src/a/readme && + poke branches/v2/start/src/a/readme && + svn commit -m "Changed 2 in v2/start" && + svn up && + svn cp branches/v2/start tags/next && + echo "bye" >> tags/next/src/b/readme && + poke tags/next/src/b/readme && + echo "aye" >> tags/next/src/a/readme && + poke tags/next/src/a/readme && + svn commit -m "adding more" && + echo "byebye" >> tags/next/src/b/readme && + poke tags/next/src/b/readme && + svn commit -m "adios" + ) && + git config --add svn-remote.four.url "$svnrepo" && + git config --add svn-remote.four.fetch trunk:refs/remotes/four/trunk && + git config --add svn-remote.four.branches \ + "branches/*/*:refs/remotes/four/branches/*/*" && + git config --add svn-remote.four.tags \ + "tags/*:refs/remotes/four/tags/*" && + git svn fetch four && + test `git rev-list refs/remotes/four/tags/next | wc -l` -eq 5 && + test `git rev-list refs/remotes/four/branches/v2/start | wc -l` -eq 3 && + test `git rev-parse refs/remotes/four/branches/v2/start~2` = \ + `git rev-parse refs/remotes/four/trunk` && + test `git rev-parse refs/remotes/four/tags/next~2` = \ + `git rev-parse refs/remotes/four/branches/v2/start` && + git log --pretty=oneline refs/remotes/four/tags/next | \ + sed -e "s/^.\{41\}//" > output.four && + test_cmp expect.four output.four + ' + +echo "Only one set of wildcard directories" \ + "(e.g. '*' or '*/*/*') is supported: 'branches/*/t/*'" > expect.three +echo "" >> expect.three + +test_expect_success 'test disallow multiple globs' ' + git config --add svn-remote.three.url "$svnrepo" && + git config --add svn-remote.three.fetch \ + trunk:refs/remotes/three/trunk && + git config --add svn-remote.three.branches \ + "branches/*/t/*:refs/remotes/three/branches/*/*" && + git config --add svn-remote.three.tags \ + "tags/*:refs/remotes/three/tags/*" && + ( + cd tmp && + echo "try try" >> tags/end/src/b/readme && + poke tags/end/src/b/readme && + svn commit -m "try to try" + ) && + test_must_fail git svn fetch three 2> stderr.three && + test_cmp expect.three stderr.three + ' + +test_done diff --git a/t/t9137-git-svn-dcommit-clobber-series.sh b/t/t9137-git-svn-dcommit-clobber-series.sh new file mode 100755 index 000000000..fd185011b --- /dev/null +++ b/t/t9137-git-svn-dcommit-clobber-series.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +test_description='git svn dcommit clobber series' +. ./lib-git-svn.sh + +test_expect_success 'initialize repo' ' + mkdir import && + cd import && + awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file + svn import -m "initial" . "$svnrepo" && + cd .. && + git svn init "$svnrepo" && + git svn fetch && + test -e file + ' + +test_expect_success '(supposedly) non-conflicting change from SVN' ' + test x"`sed -n -e 58p < file`" = x58 && + test x"`sed -n -e 61p < file`" = x61 && + svn co "$svnrepo" tmp && + cd tmp && + perl -i.bak -p -e "s/^58$/5588/" file && + perl -i.bak -p -e "s/^61$/6611/" file && + poke file && + test x"`sed -n -e 58p < file`" = x5588 && + test x"`sed -n -e 61p < file`" = x6611 && + svn commit -m "58 => 5588, 61 => 6611" && + cd .. + ' + +test_expect_success 'some unrelated changes to git' " + echo hi > life && + git update-index --add life && + git commit -m hi-life && + echo bye >> life && + git commit -m bye-life life + " + +test_expect_success 'change file but in unrelated area' " + test x\"\`sed -n -e 4p < file\`\" = x4 && + test x\"\`sed -n -e 7p < file\`\" = x7 && + perl -i.bak -p -e 's/^4\$/4444/' file && + perl -i.bak -p -e 's/^7\$/7777/' file && + test x\"\`sed -n -e 4p < file\`\" = x4444 && + test x\"\`sed -n -e 7p < file\`\" = x7777 && + git commit -m '4 => 4444, 7 => 7777' file && + git svn dcommit && + svn up tmp && + cd tmp && + test x\"\`sed -n -e 4p < file\`\" = x4444 && + test x\"\`sed -n -e 7p < file\`\" = x7777 && + test x\"\`sed -n -e 58p < file\`\" = x5588 && + test x\"\`sed -n -e 61p < file\`\" = x6611 + " + +test_expect_success 'attempt to dcommit with a dirty index' ' + echo foo >>file && + git add file && + test_must_fail git svn dcommit +' + +test_done