Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:34

"Jon Smirl" [off-list ref] writes:
An exact test case:

git clone git foo
git clone git foo1
cd foo
mkdir zzz
git mv gitweb zzz
cg diff >patch
cd ../foo1
cg patch <../foo/patch

This patch won't apply because zzz does not exist in foo1
A short and sweet reproduction recipe is essential for a problem
report like this, and I appreciate it very much.  "git mv" in
"master" should do the right thing and I see Johannes fixing (or
fixed) the problem of "git mv" failing in his version.

We should correctly handle cases that fit your general
description (the test t/t4112-apply-renames.sh has a file in
"klibc/arch/x86_64" which is renamed and copied to two different
locations under "include/arch").  The above does not reproduce
for me if I used "git diff HEAD >patch" in place of "cg diff" (I
cannot make cg behave on my machine).

$ mkdir zzz
$ ~/git-master/bin/git-mv gitweb zzz/
$ LANG=C LC_ALL=C find gitweb zzz -type f -print
find: gitweb: No such file or directory
zzz/gitweb/README
zzz/gitweb/gitweb.cgi
zzz/gitweb/gitweb.css
zzz/gitweb/test/M??rchen
zzz/gitweb/test/file with spaces
zzz/gitweb/test/file+plus+sign
$ git diff HEAD >patch
$ git checkout -f HEAD
$ LANG=C LC_ALL=C find gitweb zzz -type f -print
gitweb/README
gitweb/gitweb.cgi
gitweb/gitweb.css
gitweb/test/M??rchen
gitweb/test/file with spaces
gitweb/test/file+plus+sign
find: zzz: No such file or directory
$ git apply --index <patch
$ LANG=C LC_ALL=C find gitweb zzz -type f -print
zzz/gitweb/README
zzz/gitweb/gitweb.cgi
zzz/gitweb/gitweb.css
zzz/gitweb/test/M??rchen
zzz/gitweb/test/file with spaces
zzz/gitweb/test/file+plus+sign

A couple of weeks ago test t/t4114-apply-typechange.sh was added
by Eric Wong, and it caught cases where git-apply was assuming
that leading directories of a new file already exists or was
complaining when you create file "foo" and remove a file
"foo/bar" (that is, you used to have directory at "foo").  The
problems that test found were all fixed as far as I recall.

Re: [PATCH 1/2] t7001: add test for git-mv dir1 dir2/

From: Jon Smirl <hidden>
Date: 2016-06-15 22:42:34

On 7/26/06, Junio C Hamano [off-list ref] wrote:
We should correctly handle cases that fit your general
description (the test t/t4112-apply-renames.sh has a file in
"klibc/arch/x86_64" which is renamed and copied to two different
locations under "include/arch").  The above does not reproduce
for me if I used "git diff HEAD >patch" in place of "cg diff" (I
cannot make cg behave on my machine).
cg diff makes a patch this looks like this
diff --git a/gitweb/README b/zzz/gitweb/README
similarity index 100%
rename from gitweb/README
rename to zzz/gitweb/README
diff --git a/gitweb/gitweb.cgi b/zzz/gitweb/gitweb.cgi
similarity index 100%
rename from gitweb/gitweb.cgi
rename to zzz/gitweb/gitweb.cgi
diff --git a/gitweb/gitweb.css b/zzz/gitweb/gitweb.css
similarity index 100%
rename from gitweb/gitweb.css
rename to zzz/gitweb/gitweb.css
diff --git "a/gitweb/test/M\303\244rchen" "b/zzz/gitweb/test/M\303\244rchen"
similarity index 100%
rename from "gitweb/test/M\303\244rchen"
rename to "zzz/gitweb/test/M\303\244rchen"
diff --git a/gitweb/test/file with spaces b/zzz/gitweb/test/file with spaces
similarity index 100%
rename from gitweb/test/file with spaces
rename to zzz/gitweb/test/file with spaces
diff --git a/gitweb/test/file+plus+sign b/zzz/gitweb/test/file+plus+sign
similarity index 100%
rename from gitweb/test/file+plus+sign
rename to zzz/gitweb/test/file+plus+sign
git diff HEAD makes a much longer patch that deltas out the existing
files and delta in the new file.

It's applying patches in the extended git format that fails.

-- 
Jon Smirl
jonsmirl@gmail.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help