blob: 64bb495834698c8438c8b8dde488873072abc1fd [file] [log] [blame]
Eric Wong29633bb2007-07-15 21:53:50 -07001#!/bin/sh
2#
3# Copyright (c) 2007 Eric Wong
4
5
Nanako Shiraishi1364ff22008-09-08 19:02:08 +09006test_description='git svn dcommit can commit renames of files with ugly names'
Eric Wong29633bb2007-07-15 21:53:50 -07007
8. ./lib-git-svn.sh
9
Bryan Donlanf69e8362008-05-04 01:37:59 -040010test_expect_success 'load repository with strange names' '
Eric Wonga8a5d252016-07-23 04:26:08 +000011 svnadmin load -q "$rawsvnrepo" <"$TEST_DIRECTORY"/t9115/funky-names.dump
12'
13
14maybe_start_httpd gtk+
Eric Wong29633bb2007-07-15 21:53:50 -070015
Bryan Donlanf69e8362008-05-04 01:37:59 -040016test_expect_success 'init and fetch repository' '
17 git svn init "$svnrepo" &&
Eric Wong29633bb2007-07-15 21:53:50 -070018 git svn fetch &&
19 git reset --hard git-svn
Bryan Donlanf69e8362008-05-04 01:37:59 -040020 '
Eric Wong29633bb2007-07-15 21:53:50 -070021
22test_expect_success 'create file in existing ugly and empty dir' '
Eric Wong6111b932009-11-15 18:57:16 -080023 mkdir -p "#{bad_directory_name}" &&
Eric Wong29633bb2007-07-15 21:53:50 -070024 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
28 '
29
30test_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
34 '
35
36test_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 &&
Eric Wong6111b932009-11-15 18:57:16 -080041 mkdir -p regular_dir_name &&
Eric Wong29633bb2007-07-15 21:53:50 -070042 git mv pretty regular_dir_name/pretty &&
43 git commit -m "moved pretty file" &&
44 git svn dcommit
45 '
46
47test_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
51 '
52
Eric Wongd1a8d0e2008-05-10 17:14:49 -070053test_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
61 '
62
Junio C Hamano761adeb2008-05-14 13:45:16 -070063test_expect_success 'clone the repository to test rebase' '
64 git svn clone "$svnrepo" test-rebase &&
Jonathan Nieder18a82692010-09-06 20:42:54 -050065 (
66 cd test-rebase &&
67 echo test-rebase >test-rebase &&
Eric Wongd1a8d0e2008-05-10 17:14:49 -070068 git add test-rebase &&
Jens Lehmannfd4ec4f2010-09-06 20:39:54 +020069 git commit -m test-rebase
Jonathan Nieder18a82692010-09-06 20:42:54 -050070 )
Junio C Hamano761adeb2008-05-14 13:45:16 -070071 '
Eric Wongd1a8d0e2008-05-10 17:14:49 -070072
Junio C Hamano761adeb2008-05-14 13:45:16 -070073test_expect_success 'make a commit to test rebase' '
Eric Wongd1a8d0e2008-05-10 17:14:49 -070074 echo test-rebase-main > test-rebase-main &&
75 git add test-rebase-main &&
76 git commit -m test-rebase-main &&
77 git svn dcommit
Junio C Hamano761adeb2008-05-14 13:45:16 -070078 '
Eric Wongd1a8d0e2008-05-10 17:14:49 -070079
Nanako Shiraishi1364ff22008-09-08 19:02:08 +090080test_expect_success 'git svn rebase works inside a fresh-cloned repository' '
Kazutoshi Satoda40f47442016-02-09 00:20:31 +090081 (
82 cd test-rebase &&
Eric Wongd1a8d0e2008-05-10 17:14:49 -070083 git svn rebase &&
84 test -e test-rebase-main &&
85 test -e test-rebase
Kazutoshi Satoda40f47442016-02-09 00:20:31 +090086 )'
87
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.
96prepare_a_utf8_locale
Johannes Schindelin8257d3b2016-03-23 11:55:20 +010097test_expect_success UTF8,!MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 new file on dcommit' '
Kazutoshi Satoda40f47442016-02-09 00:20:31 +090098 LC_ALL=$a_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
106'
Eric Wongd1a8d0e2008-05-10 17:14:49 -0700107
Kazutoshi Satoda1b42f452016-02-09 00:21:02 +0900108# See the comment on the above test for setting of LC_ALL.
Johannes Schindelin8257d3b2016-03-23 11:55:20 +0100109test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename on dcommit' '
Kazutoshi Satoda1b42f452016-02-09 00:21:02 +0900110 LC_ALL=$a_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
121'
122
Eric Wong29633bb2007-07-15 21:53:50 -0700123stop_httpd
124
125test_done