]> git.ipfire.org Git - thirdparty/git.git/blame - t/t9148-git-svn-propset.sh
Sync with 2.36.3
[thirdparty/git.git] / t / t9148-git-svn-propset.sh
CommitLineData
83c9433e
AP
1#!/bin/sh
2#
3# Copyright (c) 2014 Alfred Perlstein
4#
5
6test_description='git svn propset tests'
7
7a98d9ab 8TEST_FAILS_SANITIZE_LEAK=true
83c9433e
AP
9. ./lib-git-svn.sh
10
4f4d2017
ÆAB
11test_expect_success 'setup propset via import' '
12 test_when_finished "rm -rf import" &&
13
14 foo_subdir2="subdir/subdir2/foo_subdir2" &&
15 mkdir -p import/subdir/subdir2 &&
16 (
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"
25 )
26'
83c9433e
AP
27
28test_expect_success 'initialize git svn' '
29 git svn init "$svnrepo"
30 '
31
32test_expect_success 'fetch revisions from svn' '
33 git svn fetch
34 '
35
36set_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")
47}
48
49confirm_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)
58}
59
60
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
64test_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
70 '
71
72test_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
80 '
81
82test_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
88 '
89
90test_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
98 '
99test_done