git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Filenames and prefixes in extended diffs
@ 2010-01-13 16:13 Andreas Gruenbacher
  2010-01-13 19:49 ` Junio C Hamano
  2010-01-14  0:16 ` Junio C Hamano
  0 siblings, 2 replies; 20+ messages in thread
From: Andreas Gruenbacher @ 2010-01-13 16:13 UTC (permalink / raw)
  To: git

I'm having a problem filename prefixes in git's extended diffs for patches 
which rename or copy files: those patches include the old and new filenames in 
"rename from", "rename to", "copy from", and "copy to" headers, e.g.,

	$ git show -M
	diff --git a/f b/g
	similarity index 87%
	rename from f
	rename to g
	index f00c965..3bb459b 100644
	--- a/f
	+++ b/g
	@@ -8,3 +8,4 @@
	 8
	 9
	 10
	+11

Unlike the filenames in the "diff --git", "---", and "+++" headers, the 
"rename from", "rename to", "copy from", and "copy to" filenames do not 
include prefixes.

Now when applying a patch, GNU patch's -p option determines the number of 
pathname components to strip off from filenames.  This obviously can't work 
consistently for the prefixed and prefix-less headers.

Can git be changed to include prefixes in all filenames?

The only alternative I see is to ignore the filenames in the rename/copy 
headers and rely only on the "diff --git" line.  (The "---" and "+++" headers 
are not guaranteed to exist.)  What's worse, as already discussed here, the 
"diff --git" line uses space as a separator between filenames yet it doesn't 
quote spaces in filenames.  When being forced to ignore rename/copy headers, 
this defect would make things much worse.


Any ideas?


Thanks,
Andreas

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2010-01-18 23:22 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 16:13 Filenames and prefixes in extended diffs Andreas Gruenbacher
2010-01-13 19:49 ` Junio C Hamano
2010-01-14  0:16 ` Junio C Hamano
2010-01-15 13:32   ` Nanako Shiraishi
2010-01-15 18:09     ` Junio C Hamano
2010-01-15 20:50       ` [PATCH] grep: prepare to run outside of a work tree Junio C Hamano
2010-01-15 20:52       ` [PATCH] grep --no-index: allow use of "git grep" outside a git repository Junio C Hamano
2010-01-15 21:08         ` Jeff King
2010-01-16  1:05           ` Junio C Hamano
2010-01-16  1:15             ` Jeff King
2010-01-16  4:15               ` Junio C Hamano
2010-01-16  6:51                 ` David Aguilar
2010-01-16  7:21                   ` Junio C Hamano
2010-01-18  1:51                 ` Jeff King
2010-01-18  3:35                   ` Junio C Hamano
2010-01-18  4:02                     ` Junio C Hamano
2010-01-18  5:57                       ` Jeff King
2010-01-18  6:30                         ` Junio C Hamano
2010-01-18  6:50                           ` Jeff King
2010-01-18 23:22   ` Filenames and prefixes in extended diffs Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).