Code

diff-options.txt: Fix asciidoc markup issue
[git.git] / t / t9104-git-svn-follow-parent.sh
index 4d964e2db7cc3c96fc64911bd58c4f2f9679a6cd..ab9fa322200b333dd0222be6b712c6651f4419fb 100755 (executable)
@@ -3,7 +3,7 @@
 # Copyright (c) 2006 Eric Wong
 #
 
-test_description='git-svn fetching'
+test_description='git svn fetching'
 . ./lib-git-svn.sh
 
 test_expect_success 'initialize repo' '
@@ -27,8 +27,8 @@ test_expect_success 'initialize repo' '
        '
 
 test_expect_success 'init and fetch a moved directory' '
-       git-svn init --minimize-url -i thunk "$svnrepo"/thunk &&
-       git-svn fetch -i thunk &&
+       git svn init --minimize-url -i thunk "$svnrepo"/thunk &&
+       git svn fetch -i thunk &&
        test "`git rev-parse --verify refs/remotes/thunk@2`" \
            = "`git rev-parse --verify refs/remotes/thunk~1`" &&
         test "`git cat-file blob refs/remotes/thunk:readme |\
@@ -43,7 +43,7 @@ test_expect_success 'init and fetch from one svn-remote' '
           trunk:refs/remotes/svn/trunk &&
         git config --add svn-remote.svn.fetch \
           thunk:refs/remotes/svn/thunk &&
-        git-svn fetch -i svn/thunk &&
+        git svn fetch -i svn/thunk &&
        test "`git rev-parse --verify refs/remotes/svn/trunk`" \
            = "`git rev-parse --verify refs/remotes/svn/thunk~1`" &&
         test "`git cat-file blob refs/remotes/svn/thunk:readme |\
@@ -57,8 +57,8 @@ test_expect_success 'follow deleted parent' '
                -r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
         git config --add svn-remote.svn.fetch \
           junk:refs/remotes/svn/junk &&
-        git-svn fetch -i svn/thunk &&
-        git-svn fetch -i svn/junk &&
+        git svn fetch -i svn/thunk &&
+        git svn fetch -i svn/junk &&
         test -z "`git diff svn/junk svn/trunk`" &&
         test "`git merge-base svn/junk svn/trunk`" \
            = "`git rev-parse svn/trunk`"
@@ -69,9 +69,9 @@ test_expect_success 'follow larger parent' '
         echo hi > import/trunk/thunk/bump/thud/file &&
         svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
         svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
-        git-svn init --minimize-url -i larger \
+        git svn init --minimize-url -i larger \
           "$svnrepo"/another-larger/trunk/thunk/bump/thud &&
-        git-svn fetch -i larger &&
+        git svn fetch -i larger &&
         git rev-parse --verify refs/remotes/larger &&
         git rev-parse --verify \
            refs/remotes/larger-parent/trunk/thunk/bump/thud &&
@@ -92,15 +92,15 @@ test_expect_success 'follow higher-level parent' '
                 cd ..
         svn mkdir -m "new glob at top level" "$svnrepo"/glob &&
         svn mv -m "move blob down a level" "$svnrepo"/blob "$svnrepo"/glob/blob &&
-        git-svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
-        git-svn fetch -i blob
+        git svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
+        git svn fetch -i blob
         '
 
 test_expect_success 'follow deleted directory' '
        svn mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
        svn rm -m "remove glob" "$svnrepo"/glob &&
-       git-svn init --minimize-url -i glob "$svnrepo"/glob &&
-       git-svn fetch -i glob &&
+       git svn init --minimize-url -i glob "$svnrepo"/glob &&
+       git svn fetch -i glob &&
        test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
        test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1
        '
@@ -129,9 +129,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
          poke native/t/c.t &&
          svn commit -m "reorg test" &&
        cd .. &&
-       git-svn init --minimize-url -i r9270-t \
+       git svn init --minimize-url -i r9270-t \
          "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
-       git-svn fetch -i r9270-t &&
+       git svn fetch -i r9270-t &&
        test `git rev-list r9270-t | wc -l` -eq 2 &&
        test "`git ls-tree --name-only r9270-t~1`" = \
             "`git ls-tree --name-only r9270-t`"
@@ -139,9 +139,9 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
 
 test_expect_success "track initial change if it was only made to parent" '
        svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
-       git-svn init --minimize-url -i r9270-d \
+       git svn init --minimize-url -i r9270-d \
          "$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
-       git-svn fetch -i r9270-d &&
+       git svn fetch -i r9270-d &&
        test `git rev-list r9270-d | wc -l` -eq 3 &&
        test "`git ls-tree --name-only r9270-t`" = \
             "`git ls-tree --name-only r9270-d`" &&
@@ -149,21 +149,63 @@ test_expect_success "track initial change if it was only made to parent" '
             "`git rev-parse r9270-d~1`"
        '
 
+test_expect_success "follow-parent is atomic" '
+       (
+               cd wc &&
+               svn up &&
+               svn mkdir stunk &&
+               echo "trunk stunk" > stunk/readme &&
+               svn add stunk/readme &&
+               svn ci -m "trunk stunk" &&
+               echo "stunk like junk" >> stunk/readme &&
+               svn ci -m "really stunk" &&
+               echo "stink stank stunk" >> stunk/readme &&
+               svn ci -m "even the grinch agrees"
+       ) &&
+       svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
+       { svn cp -m "early stunk flunked too" \
+               "$svnrepo"/stunk@17 "$svnrepo"/flunked ||
+       svn cp -m "early stunk flunked too" \
+               -r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
+       git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
+       git svn fetch -i stunk &&
+       git update-ref refs/remotes/flunk@18 refs/remotes/stunk~2 &&
+       git update-ref -d refs/remotes/stunk &&
+       git config --unset svn-remote.svn.fetch stunk &&
+       mkdir -p "$GIT_DIR"/svn/flunk@18 &&
+       rev_map=$(cd "$GIT_DIR"/svn/stunk && ls .rev_map*) &&
+       dd if="$GIT_DIR"/svn/stunk/$rev_map \
+          of="$GIT_DIR"/svn/flunk@18/$rev_map bs=24 count=1 &&
+       rm -rf "$GIT_DIR"/svn/stunk &&
+       git svn init --minimize-url -i flunk "$svnrepo"/flunk &&
+       git svn fetch -i flunk &&
+       git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
+       git svn fetch -i stunk &&
+       git svn init --minimize-url -i flunked "$svnrepo"/flunked &&
+       git svn fetch -i flunked
+       test "`git rev-parse --verify refs/remotes/flunk@18`" \
+          = "`git rev-parse --verify refs/remotes/stunk`" &&
+       test "`git rev-parse --verify refs/remotes/flunk~1`" \
+          = "`git rev-parse --verify refs/remotes/stunk`" &&
+       test "`git rev-parse --verify refs/remotes/flunked~1`" \
+          = "`git rev-parse --verify refs/remotes/stunk~1`"
+       '
+
 test_expect_success "track multi-parent paths" '
        svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
-       git-svn multi-fetch &&
+       git svn multi-fetch &&
        test `git cat-file commit refs/remotes/glob | \
               grep "^parent " | wc -l` -eq 2
        '
 
 test_expect_success "multi-fetch continues to work" "
-       git-svn multi-fetch
+       git svn multi-fetch
        "
 
 test_expect_success "multi-fetch works off a 'clean' repository" '
        rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" &&
        mkdir "$GIT_DIR/svn" &&
-       git-svn multi-fetch
+       git svn multi-fetch
        '
 
 test_debug 'gitk --all &'