]>
Commit | Line | Data |
---|---|---|
128de657 BK |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2008 Brad King | |
4 | ||
5 | test_description='git-svn dcommit honors auto-props' | |
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 | ||
19 | test_expect_success 'initialize git-svn' ' | |
20 | mkdir import && | |
21 | ( | |
22 | cd import && | |
23 | echo foo >foo && | |
24 | svn import -m "import for git-svn" . "$svnrepo" | |
25 | ) && | |
26 | rm -rf import && | |
27 | git-svn init "$svnrepo" | |
28 | git-svn fetch | |
29 | ' | |
30 | ||
31 | test_expect_success 'enable auto-props config' ' | |
32 | cd "$gittestrepo" && | |
33 | mkdir user && | |
34 | generate_auto_props yes >user/config | |
35 | ' | |
36 | ||
37 | test_expect_success 'add files matching auto-props' ' | |
38 | cd "$gittestrepo" && | |
39 | echo "#!$SHELL_PATH" >exec1.sh && | |
40 | chmod +x exec1.sh && | |
41 | echo "hello" >hello.txt && | |
42 | echo bar >bar && | |
43 | git add exec1.sh hello.txt bar && | |
44 | git commit -m "files for enabled auto-props" && | |
45 | git svn dcommit --config-dir=user | |
46 | ' | |
47 | ||
48 | test_expect_success 'disable auto-props config' ' | |
49 | cd "$gittestrepo" && | |
50 | generate_auto_props no >user/config | |
51 | ' | |
52 | ||
53 | test_expect_success 'add files matching disabled auto-props' ' | |
54 | cd "$gittestrepo" && | |
55 | echo "#$SHELL_PATH" >exec2.sh && | |
56 | chmod +x exec2.sh && | |
57 | echo "world" >world.txt && | |
58 | echo zot >zot && | |
59 | git add exec2.sh world.txt zot && | |
60 | git commit -m "files for disabled auto-props" && | |
61 | git svn dcommit --config-dir=user | |
62 | ' | |
63 | ||
64 | test_expect_success 'check resulting svn repository' ' | |
65 | mkdir work && | |
66 | cd work && | |
67 | svn co "$svnrepo" && | |
68 | cd svnrepo && | |
69 | ||
70 | # Check properties from first commit. | |
71 | test "x$(svn propget svn:executable exec1.sh)" = "x*" && | |
72 | test "x$(svn propget svn:mime-type exec1.sh)" = \ | |
73 | "xapplication/x-shellscript" && | |
74 | test "x$(svn propget svn:mime-type hello.txt)" = "xtext/plain" && | |
75 | test "x$(svn propget svn:eol-style hello.txt)" = "xnative" && | |
76 | test "x$(svn propget svn:mime-type bar)" = "x" && | |
77 | ||
78 | # Check properties from second commit. | |
79 | test "x$(svn propget svn:executable exec2.sh)" = "x*" && | |
80 | test "x$(svn propget svn:mime-type exec2.sh)" = "x" && | |
81 | test "x$(svn propget svn:mime-type world.txt)" = "x" && | |
82 | test "x$(svn propget svn:eol-style world.txt)" = "x" && | |
83 | test "x$(svn propget svn:mime-type zot)" = "x" | |
84 | ' | |
85 | ||
86 | test_done |