git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruen@suse.de>
To: git@vger.kernel.org
Subject: Filenames and prefixes in extended diffs
Date: Wed, 13 Jan 2010 17:13:05 +0100	[thread overview]
Message-ID: <201001131713.05505.agruen@suse.de> (raw)

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

             reply	other threads:[~2010-01-13 16:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 16:13 Andreas Gruenbacher [this message]
2010-01-13 19:49 ` Filenames and prefixes in extended diffs 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201001131713.05505.agruen@suse.de \
    --to=agruen@suse.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).