ref-filter.c: drop return from void function
[git/debian.git] / t / t9148-git-svn-propset.sh
blob102639090c11f3548b1c2b1b391a04b8b0cf05ba
1 #!/bin/sh
3 # Copyright (c) 2014 Alfred Perlstein
6 test_description='git svn propset tests'
8 . ./lib-git-svn.sh
10 foo_subdir2="subdir/subdir2/foo_subdir2"
12 set -e
13 mkdir import &&
14 (set -e ; cd import
15 mkdir subdir
16 mkdir subdir/subdir2
17 touch foo # for 'add props top level'
18 touch subdir/foo_subdir # for 'add props relative'
19 touch "$foo_subdir2" # for 'add props subdir'
20 svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
22 rm -rf import
24 test_expect_success 'initialize git svn' '
25 git svn init "$svnrepo"
28 test_expect_success 'fetch revisions from svn' '
29 git svn fetch
32 set_props () {
33 subdir="$1"
34 file="$2"
35 shift;shift;
36 (cd "$subdir" &&
37 while [ $# -gt 0 ] ; do
38 git svn propset "$1" "$2" "$file" || exit 1
39 shift;shift;
40 done &&
41 echo hello >> "$file" &&
42 git commit -m "testing propset" "$file")
45 confirm_props () {
46 subdir="$1"
47 file="$2"
48 shift;shift;
49 (set -e ; cd "svn_project/$subdir" &&
50 while [ $# -gt 0 ] ; do
51 test "$(svn_cmd propget "$1" "$file")" = "$2" || exit 1
52 shift;shift;
53 done)
57 #The current implementation has a restriction:
58 #svn propset will be taken as a delta for svn dcommit only
59 #if the file content is also modified
60 test_expect_success 'add props top level' '
61 set_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
62 git svn dcommit &&
63 svn_cmd co "$svnrepo" svn_project &&
64 confirm_props "." "foo" "svn:keywords" "FreeBSD=%H" &&
65 rm -rf svn_project
68 test_expect_success 'add multiple props' '
69 set_props "." "foo" \
70 "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
71 git svn dcommit &&
72 svn_cmd co "$svnrepo" svn_project &&
73 confirm_props "." "foo" \
74 "svn:keywords" "FreeBSD=%H" fbsd:nokeywords yes &&
75 rm -rf svn_project
78 test_expect_success 'add props subdir' '
79 set_props "." "$foo_subdir2" svn:keywords "FreeBSD=%H" &&
80 git svn dcommit &&
81 svn_cmd co "$svnrepo" svn_project &&
82 confirm_props "." "$foo_subdir2" "svn:keywords" "FreeBSD=%H" &&
83 rm -rf svn_project
86 test_expect_success 'add props relative' '
87 set_props "subdir/subdir2" "../foo_subdir" \
88 svn:keywords "FreeBSD=%H" &&
89 git svn dcommit &&
90 svn_cmd co "$svnrepo" svn_project &&
91 confirm_props "subdir/subdir2" "../foo_subdir" \
92 svn:keywords "FreeBSD=%H" &&
93 rm -rf svn_project
95 test_done