Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2007 Eric Wong |
| 4 | |
| 5 | |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 6 | test_description='git svn dcommit can commit renames of files with ugly names' |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 7 | |
| 8 | . ./lib-git-svn.sh |
| 9 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 10 | test_expect_success 'load repository with strange names' ' |
Eric Wong | a8a5d25 | 2016-07-23 04:26:08 +0000 | [diff] [blame] | 11 | svnadmin load -q "$rawsvnrepo" <"$TEST_DIRECTORY"/t9115/funky-names.dump |
| 12 | ' |
| 13 | |
| 14 | maybe_start_httpd gtk+ |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 15 | |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 16 | test_expect_success 'init and fetch repository' ' |
| 17 | git svn init "$svnrepo" && |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 18 | git svn fetch && |
| 19 | git reset --hard git-svn |
Bryan Donlan | f69e836 | 2008-05-04 01:37:59 -0400 | [diff] [blame] | 20 | ' |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 21 | |
| 22 | test_expect_success 'create file in existing ugly and empty dir' ' |
Eric Wong | 6111b93 | 2009-11-15 18:57:16 -0800 | [diff] [blame] | 23 | mkdir -p "#{bad_directory_name}" && |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 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 |
| 28 | ' |
| 29 | |
| 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 |
| 34 | ' |
| 35 | |
| 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 && |
Eric Wong | 6111b93 | 2009-11-15 18:57:16 -0800 | [diff] [blame] | 41 | mkdir -p regular_dir_name && |
Eric Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 42 | git mv pretty regular_dir_name/pretty && |
| 43 | git commit -m "moved pretty file" && |
| 44 | git svn dcommit |
| 45 | ' |
| 46 | |
| 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 |
| 51 | ' |
| 52 | |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 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 |
| 61 | ' |
| 62 | |
Junio C Hamano | 761adeb | 2008-05-14 13:45:16 -0700 | [diff] [blame] | 63 | test_expect_success 'clone the repository to test rebase' ' |
| 64 | git svn clone "$svnrepo" test-rebase && |
Jonathan Nieder | 18a8269 | 2010-09-06 20:42:54 -0500 | [diff] [blame] | 65 | ( |
| 66 | cd test-rebase && |
| 67 | echo test-rebase >test-rebase && |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 68 | git add test-rebase && |
Jens Lehmann | fd4ec4f | 2010-09-06 20:39:54 +0200 | [diff] [blame] | 69 | git commit -m test-rebase |
Jonathan Nieder | 18a8269 | 2010-09-06 20:42:54 -0500 | [diff] [blame] | 70 | ) |
Junio C Hamano | 761adeb | 2008-05-14 13:45:16 -0700 | [diff] [blame] | 71 | ' |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 72 | |
Junio C Hamano | 761adeb | 2008-05-14 13:45:16 -0700 | [diff] [blame] | 73 | test_expect_success 'make a commit to test rebase' ' |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 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 |
Junio C Hamano | 761adeb | 2008-05-14 13:45:16 -0700 | [diff] [blame] | 78 | ' |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 79 | |
Nanako Shiraishi | 1364ff2 | 2008-09-08 19:02:08 +0900 | [diff] [blame] | 80 | test_expect_success 'git svn rebase works inside a fresh-cloned repository' ' |
Kazutoshi Satoda | 40f4744 | 2016-02-09 00:20:31 +0900 | [diff] [blame] | 81 | ( |
| 82 | cd test-rebase && |
Eric Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 83 | git svn rebase && |
| 84 | test -e test-rebase-main && |
| 85 | test -e test-rebase |
Kazutoshi Satoda | 40f4744 | 2016-02-09 00:20:31 +0900 | [diff] [blame] | 86 | )' |
| 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. |
| 96 | prepare_a_utf8_locale |
Johannes Schindelin | 8257d3b | 2016-03-23 11:55:20 +0100 | [diff] [blame] | 97 | test_expect_success UTF8,!MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 new file on dcommit' ' |
Kazutoshi Satoda | 40f4744 | 2016-02-09 00:20:31 +0900 | [diff] [blame] | 98 | 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 Wong | d1a8d0e | 2008-05-10 17:14:49 -0700 | [diff] [blame] | 107 | |
Kazutoshi Satoda | 1b42f45 | 2016-02-09 00:21:02 +0900 | [diff] [blame] | 108 | # See the comment on the above test for setting of LC_ALL. |
Johannes Schindelin | 8257d3b | 2016-03-23 11:55:20 +0100 | [diff] [blame] | 109 | test_expect_success !MINGW,!UTF8_NFD_TO_NFC 'svn.pathnameencoding=cp932 rename on dcommit' ' |
Kazutoshi Satoda | 1b42f45 | 2016-02-09 00:21:02 +0900 | [diff] [blame] | 110 | 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 Wong | 29633bb | 2007-07-15 21:53:50 -0700 | [diff] [blame] | 123 | stop_httpd |
| 124 | |
| 125 | test_done |