push: fix capitalisation of the option name autoSetupMerge
[alt-git.git] / t / t9148-git-svn-propset.sh
blob6cc76a07b39a90d590759bbb7033da3953969092
1 #!/bin/sh
3 # Copyright (c) 2014 Alfred Perlstein
6 test_description='git svn propset tests'
8 TEST_FAILS_SANITIZE_LEAK=true
9 . ./lib-git-svn.sh
11 test_expect_success 'setup propset via import' '
12 test_when_finished "rm -rf import" &&
14 foo_subdir2="subdir/subdir2/foo_subdir2" &&
15 mkdir -p import/subdir/subdir2 &&
17 cd import &&
18 # for "add props top level"
19 >foo &&
20 # for "add props relative"
21 >subdir/foo_subdir &&
22 # for "add props subdir"
23 >"$foo_subdir2" &&
24 svn_cmd import -m "import for git svn" . "$svnrepo"
28 test_expect_success 'initialize git svn' '
29 git svn init "$svnrepo"
32 test_expect_success 'fetch revisions from svn' '
33 git svn fetch
36 set_props () {
37 subdir="$1"
38 file="$2"
39 shift;shift;
40 (cd "$subdir" &&
41 while [ $# -gt 0 ] ; do
42 git svn propset "$1" "$2" "$file" || exit 1
43 shift;shift;
44 done &&
45 echo hello >> "$file" &&
46 git commit -m "testing propset" "$file")
49 confirm_props () {
50 subdir="$1"
51 file="$2"
52 shift;shift;
53 (set -e ; cd "svn_project/$subdir" &&
54 while [ $# -gt 0 ] ; do
55 test "$(svn_cmd propget "$1" "$file")" = "$2" || exit 1
56 shift;shift;
57 done)
61 #The current implementation has a restriction:
62 #svn propset will be taken as a delta for svn dcommit only
63 #if the file content is also modified
64 test_expect_success 'add props top level' '
65 set_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
66 git svn dcommit &&
67 svn_cmd co "$svnrepo" svn_project &&
68 confirm_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
69 rm -rf svn_project
72 test_expect_success 'add multiple props' '
73 set_props "." "foo" \
74 "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
75 git svn dcommit &&
76 svn_cmd co "$svnrepo" svn_project &&
77 confirm_props "." "foo" \
78 "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
79 rm -rf svn_project
82 test_expect_success 'add props subdir' '
83 set_props "." "$foo_subdir2" svn:keywords "FreeBSD=%H" &&
84 git svn dcommit &&
85 svn_cmd co "$svnrepo" svn_project &&
86 confirm_props "." "$foo_subdir2" "svn:keywords" "FreeBSD=%H" &&
87 rm -rf svn_project
90 test_expect_success 'add props relative' '
91 set_props "subdir/subdir2" "../foo_subdir" \
92 svn:keywords "FreeBSD=%H" &&
93 git svn dcommit &&
94 svn_cmd co "$svnrepo" svn_project &&
95 confirm_props "subdir/subdir2" "../foo_subdir" \
96 svn:keywords "FreeBSD=%H" &&
97 rm -rf svn_project
99 test_done