From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "Jörg Sommer" <joerg@alea.gnuu.de>,
"Wincent Colaiuta" <win@wincent.com>
Subject: Re: [PATCH 1/2] add--interactive: ignore mode change in 'p'atch command
Date: Thu, 27 Mar 2008 09:24:10 -0700 [thread overview]
Message-ID: <7v7ifob0et.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080327073043.GB22444@coredump.intra.peff.net> (Jeff King's message of "Thu, 27 Mar 2008 03:30:43 -0400")
Jeff King <peff@peff.net> writes:
> When a path is examined in the patch subcommand, any mode
> changes in the file are given to use in the diff header by
> git-diff. If no hunks are staged, then we throw out that
> header. But if _any_ hunks are staged, we use the header,
> and the mode is changed.
>
> Since the 'p'atch command should just be dealing with hunks
> that are shown to the user, it makes sense to just ignore
> mode changes entirely. We do squirrel away the mode, though,
> since a future patch will allow users to select the mode
> update.
I agree that treating each logical block of the metainformation as if it
is a hunk on its own makes sense. Possibly, it would be useful to make
the interactive patch session look like this:
diff --git a/gostak b/doshes
old mode 100644
new mode 100755
Stage the mode change [y/n/a/d/j/J/?]?
similarity index 90%
rename from gostak
rename to doshes
Stage the name change [y/n/a/d/j/J/?]?
@@ -1,5 +1,5 @@
The
-gostak
+Gostak
distims
doshes
Stage this hunk [y/n/a/d/j/J/?]?
Handlilng the rename needs a bit more thought and enhancements not just in
your parse_diff_header() code but the way we extract the diff text (we
would need to first find renames by whole-tree diff and then feed two
(src,dst) paths in parse_diff() to obtain the text), but it should be
doable.
By the way, why was it done as a new sub called from parse_diff() and not
as a part of parse_diff() itself?
next prev parent reply other threads:[~2008-03-27 16:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1206602393.git.peff@peff.net>
2008-03-27 7:30 ` [PATCH 1/2] add--interactive: ignore mode change in 'p'atch command Jeff King
2008-03-27 16:24 ` Junio C Hamano [this message]
2008-03-27 17:10 ` Jeff King
2008-03-27 18:29 ` Junio C Hamano
2008-03-27 19:31 ` Jeff King
[not found] ` <m3fxucuesq.fsf@localhost.localdomain>
2008-03-27 22:16 ` Jeff King
2008-03-27 7:32 ` [PATCH 2/2] add--interactive: allow user to choose mode update Jeff King
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=7v7ifob0et.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=joerg@alea.gnuu.de \
--cc=peff@peff.net \
--cc=win@wincent.com \
/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