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