]>
Commit | Line | Data |
---|---|---|
128de657 BK |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2008 Brad King | |
4 | ||
1364ff27 | 5 | test_description='git svn dcommit honors auto-props' |
128de657 BK |
6 | |
7 | . ./lib-git-svn.sh | |
8 | ||
9 | generate_auto_props() { | |
10 | cat << EOF | |
11 | [miscellany] | |
12 | enable-auto-props=$1 | |
13 | [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 | |
16 | EOF | |
17 | } | |
18 | ||
f964732c | 19 | test_expect_success 'initialize git svn' ' |
128de657 BK |
20 | mkdir import && |
21 | ( | |
22 | cd import && | |
23 | echo foo >foo && | |
da083d68 | 24 | svn_cmd import -m "import for git svn" . "$svnrepo" |
128de657 BK |
25 | ) && |
26 | rm -rf import && | |
a48fcd83 | 27 | git svn init "$svnrepo" && |
1364ff27 | 28 | git svn fetch |
128de657 BK |
29 | ' |
30 | ||
31 | test_expect_success 'enable auto-props config' ' | |
128de657 BK |
32 | mkdir user && |
33 | generate_auto_props yes >user/config | |
34 | ' | |
35 | ||
36 | test_expect_success 'add files matching auto-props' ' | |
b2fe0657 | 37 | write_script exec1.sh </dev/null && |
128de657 BK |
38 | echo "hello" >hello.txt && |
39 | echo bar >bar && | |
40 | git add exec1.sh hello.txt bar && | |
41 | git commit -m "files for enabled auto-props" && | |
42 | git svn dcommit --config-dir=user | |
43 | ' | |
44 | ||
45 | test_expect_success 'disable auto-props config' ' | |
128de657 BK |
46 | generate_auto_props no >user/config |
47 | ' | |
48 | ||
49 | test_expect_success 'add files matching disabled auto-props' ' | |
b2fe0657 | 50 | write_script exec2.sh </dev/null && |
128de657 BK |
51 | echo "world" >world.txt && |
52 | echo zot >zot && | |
53 | git add exec2.sh world.txt zot && | |
54 | git commit -m "files for disabled auto-props" && | |
55 | git svn dcommit --config-dir=user | |
56 | ' | |
57 | ||
58 | test_expect_success 'check resulting svn repository' ' | |
a786091b | 59 | ( |
128de657 BK |
60 | mkdir work && |
61 | cd work && | |
da083d68 | 62 | svn_cmd co "$svnrepo" && |
128de657 BK |
63 | cd svnrepo && |
64 | ||
65 | # Check properties from first commit. | |
b2fe0657 JS |
66 | if test_have_prereq POSIXPERM |
67 | then | |
68 | test "x$(svn_cmd propget svn:executable exec1.sh)" = "x*" | |
69 | fi && | |
da083d68 | 70 | test "x$(svn_cmd propget svn:mime-type exec1.sh)" = \ |
128de657 | 71 | "xapplication/x-shellscript" && |
da083d68 ER |
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" && | |
128de657 BK |
75 | |
76 | # Check properties from second commit. | |
b2fe0657 JS |
77 | if test_have_prereq POSIXPERM |
78 | then | |
79 | test "x$(svn_cmd propget svn:executable exec2.sh)" = "x*" | |
80 | fi && | |
da083d68 ER |
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" | |
a786091b | 85 | ) |
128de657 BK |
86 | ' |
87 | ||
7c4d0219 PT |
88 | test_expect_success 'check renamed file' ' |
89 | test -d user && | |
90 | generate_auto_props yes > user/config && | |
91 | git mv foo foo.sh && | |
92 | git commit -m "foo => foo.sh" && | |
93 | git svn dcommit --config-dir=user && | |
94 | ( | |
95 | cd work/svnrepo && | |
da083d68 | 96 | svn_cmd up && |
7c4d0219 PT |
97 | test ! -e foo && |
98 | test -e foo.sh && | |
da083d68 | 99 | test "x$(svn_cmd propget svn:mime-type foo.sh)" = \ |
7c4d0219 | 100 | "xapplication/x-shellscript" && |
da083d68 | 101 | test "x$(svn_cmd propget svn:eol-style foo.sh)" = "xLF" |
7c4d0219 PT |
102 | ) |
103 | ' | |
104 | ||
128de657 | 105 | test_done |