* Can `add --patch` display the diff in my difftool instead of just printing it on the command line?
@ 2010-12-14 21:17 Dun Peal
2010-12-14 21:38 ` Jeff King
0 siblings, 1 reply; 3+ messages in thread
From: Dun Peal @ 2010-12-14 21:17 UTC (permalink / raw)
To: Git ML
Hi.
I'd like to display the diff of each modified working copy file, and
have the option of staging (or reversing) each patch after it is
displayed. This is exactly the same thing `add --patch` does, except I
want the diff to be displayed in my difftool (happens to be vimdiff)
rather than just being printed.
Thanks, D.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Can `add --patch` display the diff in my difftool instead of just printing it on the command line?
2010-12-14 21:17 Can `add --patch` display the diff in my difftool instead of just printing it on the command line? Dun Peal
@ 2010-12-14 21:38 ` Jeff King
2010-12-14 22:22 ` Dun Peal
0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2010-12-14 21:38 UTC (permalink / raw)
To: Dun Peal; +Cc: Git ML
On Tue, Dec 14, 2010 at 03:17:09PM -0600, Dun Peal wrote:
> I'd like to display the diff of each modified working copy file, and
> have the option of staging (or reversing) each patch after it is
> displayed. This is exactly the same thing `add --patch` does, except I
> want the diff to be displayed in my difftool (happens to be vimdiff)
> rather than just being printed.
You can't do this with "git add -p" now, but I suspect the patch would
be relatively straightforward. See patch_update_file in
git-add--interactive.perl. You just need to replace:
for (@{$head->{DISPLAY}}) {
print;
}
with code to dump the diff in @{$head->{TEXT}} either to stdin of your
display program or to a tempfile that your program operates on.
Conditional on having some config option to specify your program, of
course.
Or did you want something more integrated with vimdiff? If you want to
primarily see the diff in vim and then have mappings set up to stage or
revert changes, that is pretty straightforward to do. Just have vim dump
the relevant hunk to "git apply --cached" or "git apply -R". I would be
surprised if the vim integration packages didn't have something like
this already.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Can `add --patch` display the diff in my difftool instead of just printing it on the command line?
2010-12-14 21:38 ` Jeff King
@ 2010-12-14 22:22 ` Dun Peal
0 siblings, 0 replies; 3+ messages in thread
From: Dun Peal @ 2010-12-14 22:22 UTC (permalink / raw)
To: Jeff King; +Cc: Git ML
On Tue, Dec 14, 2010 at 3:38 PM, Jeff King <peff@peff.net> wrote:
> You can't do this with "git add -p" now, but I suspect the patch would
> be relatively straightforward. See patch_update_file in
> git-add--interactive.perl. You just need to replace:
>
> for (@{$head->{DISPLAY}}) {
> print;
> }
>
> with code to dump the diff in @{$head->{TEXT}} either to stdin of your
> display program or to a tempfile that your program operates on.
> Conditional on having some config option to specify your program, of
> course.
That's exactly what I want, thanks. Seems like there should be a flag
/ config that tells `add --interactive` to render the diffs through a
difftool. I know several Git users who always use their difftools for
large, complex patches, which are exactly the kind of patches you'd
manage with --interactive / --patch. Hope one of you Git bigwigs takes
the time to add that feature :-)
.D
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-14 22:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 21:17 Can `add --patch` display the diff in my difftool instead of just printing it on the command line? Dun Peal
2010-12-14 21:38 ` Jeff King
2010-12-14 22:22 ` Dun Peal
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).