Code

Merge git://repo.or.cz/git-gui
[git.git] / t / t9101-git-svn-props.sh
index 02c41697decd70f8e7b6c208fefe8c5e52c37fac..f420796c31db2746b71ba9d7090f37363eba214a 100755 (executable)
@@ -52,7 +52,7 @@ EOF
 cd ..
 
 rm -rf import
-test_expect_success 'checkout working copy from svn' "svn co $svnrepo test_wc"
+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 &&
@@ -66,7 +66,7 @@ test_expect_success 'setup some commits to svn' \
                svn commit -m "Propset Id" &&
        cd ..'
 
-test_expect_success 'initialize git-svn' "git-svn init $svnrepo"
+test_expect_success 'initialize git-svn' 'git-svn init "$svnrepo"'
 test_expect_success 'fetch revisions from svn' 'git-svn fetch'
 
 name='test svn:keywords ignoring'
@@ -90,9 +90,9 @@ test_expect_success "propset CR on crlf files" \
         cd ..'
 
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
-       "git-svn fetch &&
+       'git-svn fetch &&
         git pull . remotes/git-svn &&
-        svn co $svnrepo new_wc"
+        svn co "$svnrepo" new_wc'
 
 for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
 do
@@ -126,20 +126,22 @@ cat > show-ignore.expect <<\EOF
 # /
 /no-such-file*
 
-# deeply
+# /deeply/
 /deeply/no-such-file*
 
-# deeply/nested
+# /deeply/nested/
 /deeply/nested/no-such-file*
 
-# deeply/nested/directory
+# /deeply/nested/directory/
 /deeply/nested/directory/no-such-file*
 EOF
 
 test_expect_success 'test show-ignore' "
        cd test_wc &&
        mkdir -p deeply/nested/directory &&
+       touch deeply/nested/directory/.keep &&
        svn add deeply &&
+       svn up &&
        svn propset -R svn:ignore 'no-such-file*' .
        svn commit -m 'propset svn:ignore'
        cd .. &&
@@ -147,4 +149,69 @@ test_expect_success 'test show-ignore' "
        cmp show-ignore.expect show-ignore.got
        "
 
+cat >create-ignore.expect <<\EOF
+/no-such-file*
+EOF
+
+cat >create-ignore-index.expect <<\EOF
+100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0      .gitignore
+100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0      deeply/.gitignore
+100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0      deeply/nested/.gitignore
+100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0      deeply/nested/directory/.gitignore
+EOF
+
+test_expect_success 'test create-ignore' "
+       git-svn fetch && git pull . remotes/git-svn &&
+       git-svn create-ignore &&
+       cmp ./.gitignore create-ignore.expect &&
+       cmp ./deeply/.gitignore create-ignore.expect &&
+       cmp ./deeply/nested/.gitignore create-ignore.expect &&
+       cmp ./deeply/nested/directory/.gitignore create-ignore.expect &&
+       git ls-files -s | grep gitignore | cmp - create-ignore-index.expect
+       "
+
+cat >prop.expect <<\EOF
+no-such-file*
+
+EOF
+cat >prop2.expect <<\EOF
+8
+EOF
+
+# This test can be improved: since all the svn:ignore contain the same
+# pattern, it can pass even though the propget did not execute on the
+# right directory.
+test_expect_success 'test propget' "
+       git-svn propget svn:ignore . | cmp - prop.expect &&
+       cd deeply &&
+       git-svn propget svn:ignore . | cmp - ../prop.expect &&
+       git-svn propget svn:entry:committed-rev nested/directory/.keep \
+         | cmp - ../prop2.expect &&
+       git-svn propget svn:ignore .. | cmp - ../prop.expect &&
+       git-svn propget svn:ignore nested/ | cmp - ../prop.expect &&
+       git-svn propget svn:ignore ./nested | cmp - ../prop.expect &&
+       git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect
+       "
+
+cat >prop.expect <<\EOF
+Properties on '.':
+  svn:entry:committed-date
+  svn:entry:committed-rev
+  svn:entry:last-author
+  svn:entry:uuid
+  svn:ignore
+EOF
+cat >prop2.expect <<\EOF
+Properties on 'nested/directory/.keep':
+  svn:entry:committed-date
+  svn:entry:committed-rev
+  svn:entry:last-author
+  svn:entry:uuid
+EOF
+
+test_expect_success 'test proplist' "
+       git-svn proplist . | cmp - prop.expect &&
+       git-svn proplist nested/directory/.keep | cmp - prop2.expect
+       "
+
 test_done