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