Sync with 'maint'
[alt-git.git] / t / t9115-git-svn-dcommit-funky-renames.sh
blob743fbe1fe46929583aacacc60ba959c38d8a2f09
1 #!/bin/sh
3 # Copyright (c) 2007 Eric Wong
6 test_description='git svn dcommit can commit renames of files with ugly names'
8 . ./lib-git-svn.sh
10 test_expect_success 'load repository with strange names' '
11 svnadmin load -q "$rawsvnrepo" <"$TEST_DIRECTORY"/t9115/funky-names.dump
14 maybe_start_httpd gtk+
16 test_expect_success 'init and fetch repository' '
17 git svn init "$svnrepo" &&
18 git svn fetch &&
19 git reset --hard git-svn
22 test_expect_success 'create file in existing ugly and empty dir' '
23 mkdir -p "#{bad_directory_name}" &&
24 echo hi > "#{bad_directory_name}/ foo" &&
25 git update-index --add "#{bad_directory_name}/ foo" &&
26 git commit -m "new file in ugly parent" &&
27 git svn dcommit
30 test_expect_success 'rename ugly file' '
31 git mv "#{bad_directory_name}/ foo" "file name with feces" &&
32 git commit -m "rename ugly file" &&
33 git svn dcommit
36 test_expect_success 'rename pretty file' '
37 echo :x > pretty &&
38 git update-index --add pretty &&
39 git commit -m "pretty :x" &&
40 git svn dcommit &&
41 mkdir -p regular_dir_name &&
42 git mv pretty regular_dir_name/pretty &&
43 git commit -m "moved pretty file" &&
44 git svn dcommit
47 test_expect_success 'rename pretty file into ugly one' '
48 git mv regular_dir_name/pretty "#{bad_directory_name}/ booboo" &&
49 git commit -m booboo &&
50 git svn dcommit
53 test_expect_success 'add a file with plus signs' '
54 echo .. > +_+ &&
55 git update-index --add +_+ &&
56 git commit -m plus &&
57 mkdir gtk+ &&
58 git mv +_+ gtk+/_+_ &&
59 git commit -m plus_dir &&
60 git svn dcommit
63 test_expect_success 'clone the repository to test rebase' '
64 git svn clone "$svnrepo" test-rebase &&
66 cd test-rebase &&
67 echo test-rebase >test-rebase &&
68 git add test-rebase &&
69 git commit -m test-rebase
73 test_expect_success 'make a commit to test rebase' '
74 echo test-rebase-main > test-rebase-main &&
75 git add test-rebase-main &&
76 git commit -m test-rebase-main &&
77 git svn dcommit
80 test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
82 cd test-rebase &&
83 git svn rebase &&
84 test -e test-rebase-main &&
85 test -e test-rebase
88 # Without this, LC_ALL=C as set in test-lib.sh, and Cygwin converts
89 # non-ASCII characters in filenames unexpectedly, and causes errors.
90 # https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars
91 # > Some characters are disallowed in filenames on Windows filesystems. ...
92 # ...
93 # > ... All of the above characters, except for the backslash, are converted
94 # > to special UNICODE characters in the range 0xf000 to 0xf0ff (the
95 # > "Private use area") when creating or accessing files.
96 prepare_utf8_locale
97 test_expect_success UTF8,!MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 new file on dcommit' '
98 LC_ALL=$GIT_TEST_UTF8_LOCALE &&
99 export LC_ALL &&
100 neq=$(printf "\201\202") &&
101 git config svn.pathnameencoding cp932 &&
102 echo neq >"$neq" &&
103 git add "$neq" &&
104 git commit -m "neq" &&
105 git svn dcommit
108 # See the comment on the above test for setting of LC_ALL.
109 test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename on dcommit' '
110 LC_ALL=$GIT_TEST_UTF8_LOCALE &&
111 export LC_ALL &&
112 inf=$(printf "\201\207") &&
113 git config svn.pathnameencoding cp932 &&
114 echo inf >"$inf" &&
115 git add "$inf" &&
116 git commit -m "inf" &&
117 git svn dcommit &&
118 git mv "$inf" inf &&
119 git commit -m "inf rename" &&
120 git svn dcommit
123 test_done