Code

merge overwrites unstaged changes in renamed file
[git.git] / t / t9100-git-svn-basic.sh
index 570e0359e4739e178b1836887c53ddd78e3c8ec0..749b75e8d4fba546b22a0280b72891c38b5ea00a 100755 (executable)
@@ -15,24 +15,25 @@ case "$GIT_SVN_LC_ALL" in
        test_set_prereq UTF8
        ;;
 *)
-       say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
+       say "UTF-8 locale not set, some tests skipped ($GIT_SVN_LC_ALL)"
        ;;
 esac
 
 test_expect_success \
     'initialize git svn' '
        mkdir import &&
-       cd import &&
-       echo foo > foo &&
-       ln -s foo foo.link
-       mkdir -p dir/a/b/c/d/e &&
-       echo "deep dir" > dir/a/b/c/d/e/file &&
-       mkdir bar &&
-       echo "zzz" > bar/zzz &&
-       echo "#!/bin/sh" > exec.sh &&
-       chmod +x exec.sh &&
-       svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null &&
-       cd .. &&
+       (
+               cd import &&
+               echo foo >foo &&
+               ln -s foo foo.link
+               mkdir -p dir/a/b/c/d/e &&
+               echo "deep dir" >dir/a/b/c/d/e/file &&
+               mkdir bar &&
+               echo "zzz" >bar/zzz &&
+               echo "#!/bin/sh" >exec.sh &&
+               chmod +x exec.sh &&
+               svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
+       ) &&
        rm -rf import &&
        git svn init "$svnrepo"'
 
@@ -64,7 +65,8 @@ test_expect_success "$name" "
        git update-index --add dir/file/file &&
        git commit -m '$name' &&
        test_must_fail git svn set-tree --find-copies-harder --rmdir \
-               ${remotes_git_svn}..mybranch" || true
+               ${remotes_git_svn}..mybranch
+"
 
 
 name='detect node change from directory to file #1'
@@ -78,7 +80,8 @@ test_expect_success "$name" '
        git update-index --add -- bar &&
        git commit -m "$name" &&
        test_must_fail git svn set-tree --find-copies-harder --rmdir \
-               ${remotes_git_svn}..mybranch2' || true
+               ${remotes_git_svn}..mybranch2
+'
 
 
 name='detect node change from file to directory #2'
@@ -91,9 +94,12 @@ test_expect_success "$name" '
        echo yyy > bar/zzz/yyy &&
        git update-index --add bar/zzz/yyy &&
        git commit -m "$name" &&
-       test_must_fail git svn set-tree --find-copies-harder --rmdir \
-               ${remotes_git_svn}..mybranch3' || true
-
+       git svn set-tree --find-copies-harder --rmdir \
+               ${remotes_git_svn}..mybranch3 &&
+       svn_cmd up "$SVN_TREE" &&
+       test -d "$SVN_TREE"/bar/zzz &&
+       test -e "$SVN_TREE"/bar/zzz/yyy
+'
 
 name='detect node change from directory to file #2'
 test_expect_success "$name" '
@@ -106,7 +112,8 @@ test_expect_success "$name" '
        git update-index --add -- dir &&
        git commit -m "$name" &&
        test_must_fail git svn set-tree --find-copies-harder --rmdir \
-               ${remotes_git_svn}..mybranch4' || true
+               ${remotes_git_svn}..mybranch4
+'
 
 
 name='remove executable bit from a file'
@@ -133,33 +140,33 @@ test_expect_success "$name" '
        test -x "$SVN_TREE"/exec.sh'
 
 
-name='executable file becomes a symlink to bar/zzz (file)'
+name='executable file becomes a symlink to file'
 test_expect_success "$name" '
        rm exec.sh &&
-       ln -s bar/zzz exec.sh &&
+       ln -s file exec.sh &&
        git update-index exec.sh &&
        git commit -m "$name" &&
        git svn set-tree --find-copies-harder --rmdir \
                ${remotes_git_svn}..mybranch5 &&
        svn_cmd up "$SVN_TREE" &&
-       test -L "$SVN_TREE"/exec.sh'
+       test -h "$SVN_TREE"/exec.sh'
 
 name='new symlink is added to a file that was also just made executable'
 
 test_expect_success "$name" '
-       chmod +x bar/zzz &&
-       ln -s bar/zzz exec-2.sh &&
-       git update-index --add bar/zzz exec-2.sh &&
+       chmod +x file &&
+       ln -s file exec-2.sh &&
+       git update-index --add file exec-2.sh &&
        git commit -m "$name" &&
        git svn set-tree --find-copies-harder --rmdir \
                ${remotes_git_svn}..mybranch5 &&
        svn_cmd up "$SVN_TREE" &&
-       test -x "$SVN_TREE"/bar/zzz &&
-       test -L "$SVN_TREE"/exec-2.sh'
+       test -x "$SVN_TREE"/file &&
+       test -h "$SVN_TREE"/exec-2.sh'
 
 name='modify a symlink to become a file'
 test_expect_success "$name" '
-       echo git help > help || true &&
+       echo git help >help &&
        rm exec-2.sh &&
        cp help exec-2.sh &&
        git update-index exec-2.sh &&
@@ -168,7 +175,7 @@ test_expect_success "$name" '
                ${remotes_git_svn}..mybranch5 &&
        svn_cmd up "$SVN_TREE" &&
        test -f "$SVN_TREE"/exec-2.sh &&
-       test ! -L "$SVN_TREE"/exec-2.sh &&
+       test ! -h "$SVN_TREE"/exec-2.sh &&
        test_cmp help "$SVN_TREE"/exec-2.sh'
 
 name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
@@ -194,14 +201,15 @@ name='check imported tree checksums expected tree checksums'
 rm -f expected
 if test_have_prereq UTF8
 then
-       echo tree bf522353586b1b883488f2bc73dab0d9f774b9a9 > expected
+       echo tree dc68b14b733e4ec85b04ab6f712340edc5dc936e > expected
 fi
 cat >> expected <<\EOF
-tree 83654bb36f019ae4fe77a0171f81075972087624
-tree 031b8d557afc6fea52894eaebb45bec52f1ba6d1
-tree 0b094cbff17168f24c302e297f55bfac65eb8bd3
-tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
-tree 56a30b966619b863674f5978696f4a3594f2fca9
+tree c3322890dcf74901f32d216f05c5044f670ce632
+tree d3ccd5035feafd17b030c5732e7808cc49122853
+tree d03e1630363d4881e68929d532746b20b0986b83
+tree 149d63cd5878155c846e8c55d7d8487de283f89e
+tree 312b76e4f64ce14893aeac8591eb3960b065e247
+tree 149d63cd5878155c846e8c55d7d8487de283f89e
 tree d667270a1f7b109f5eb3aaea21ede14b56bfdd6e
 tree 8f51f74cf0163afc9ad68a4b1537288c4558b5a4
 EOF
@@ -271,6 +279,17 @@ test_expect_success 'able to dcommit to a subdirectory' "
        test -z \"\`git diff refs/heads/my-bar refs/remotes/bar\`\"
        "
 
+test_expect_success 'dcommit should not fail with a touched file' '
+       test_commit "commit-new-file-foo2" foo2 &&
+       test-chmtime =-60 foo &&
+       git svn dcommit
+'
+
+test_expect_success 'rebase should not fail with a touched file' '
+       test-chmtime =-60 foo &&
+       git svn rebase
+'
+
 test_expect_success 'able to set-tree to a subdirectory' "
        echo cba > d &&
        git update-index d &&