3 # Copyright (c) 2008 Brad King
5 test_description='git svn dcommit honors auto-props'
9 generate_auto_props() {
14 *.sh = svn:mime-type=application/x-shellscript; svn:eol-style=LF
15 *.txt = svn:mime-type=text/plain; svn:eol-style = native
19 test_expect_success 'initialize git svn' '
24 svn_cmd import -m "import for git svn" . "$svnrepo"
27 git svn init "$svnrepo" &&
31 test_expect_success 'enable auto-props config' '
33 generate_auto_props yes >user/config
36 test_expect_success 'add files matching auto-props' '
37 write_script exec1.sh </dev/null &&
38 echo "hello" >hello.txt &&
40 git add exec1.sh hello.txt bar &&
41 git commit -m "files for enabled auto-props" &&
42 git svn dcommit --config-dir=user
45 test_expect_success 'disable auto-props config' '
46 generate_auto_props no >user/config
49 test_expect_success 'add files matching disabled auto-props' '
50 write_script exec2.sh </dev/null &&
51 echo "world" >world.txt &&
53 git add exec2.sh world.txt zot &&
54 git commit -m "files for disabled auto-props" &&
55 git svn dcommit --config-dir=user
58 test_expect_success 'check resulting svn repository' '
62 svn_cmd co "$svnrepo" &&
65 # Check properties from first commit.
66 if test_have_prereq POSIXPERM
68 test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*"
70 test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \
71 "xapplication/x-shellscript" &&
72 test "x$(svn_cmd propget svn:mime-type hello.txt)" = "xtext/plain" &&
73 test "x$(svn_cmd propget svn:eol-style hello.txt)" = "xnative" &&
74 test "x$(svn_cmd propget svn:mime-type bar)" = "x" &&
76 # Check properties from second commit.
77 if test_have_prereq POSIXPERM
79 test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*"
81 test "x$(svn_cmd propget svn:mime-type exec2.sh)" = "x" &&
82 test "x$(svn_cmd propget svn:mime-type world.txt)" = "x" &&
83 test "x$(svn_cmd propget svn:eol-style world.txt)" = "x" &&
84 test "x$(svn_cmd propget svn:mime-type zot)" = "x"
88 test_expect_success 'check renamed file' '
90 generate_auto_props yes > user/config &&
92 git commit -m "foo => foo.sh" &&
93 git svn dcommit --config-dir=user &&
99 test "x$(svn_cmd propget svn:mime-type foo.sh)" = \
100 "xapplication/x-shellscript" &&
101 test "x$(svn_cmd propget svn:eol-style foo.sh)" = "xLF"