threads / discuss / 10204

'git diff' in rebase--interactive

Subject: 'git diff' in rebase--interactive

## tl;dr

5 messages between Oct 9, 2007 and Oct 9, 2007.

replies: 4people: 2as markdown or json

Johannes Sixt· Oct 9, 2007, 08:51 UTC · lore

I wonder for what reason rebase--interactive generates a patch using 'git diff' in the make_patch function. Is this an artefact?

I'd like to get rid of this use of 'git diff' because it invokes external diff drivers, which is totally unwanted if the driver is interactive - like the 'windiff' thing that I posted a week ago.

-- Hannes
Johannes Schindelin· Oct 9, 2007, 12:22 UTC · re: Johannes Sixt · lore

Re: 'git diff' in rebase--interactive

Hi,
On Tue, 9 Oct 2007, Johannes Sixt wrote:
> I wonder for what reason rebase--interactive generates a patch using 
> 'git diff' in the make_patch function. Is this an artefact?

It was an explicit request by people who use git-rebase regularly, and missed being able to see the patch in --interactive.

> I'd like to get rid of this use of 'git diff' because it invokes 
> external diff drivers, which is totally unwanted if the driver is 
> interactive - like the 'windiff' thing that I posted a week ago.
So you do not want to be able to run git-rebase (without -i)?

Ciao, Dscho

Johannes Sixt· Oct 9, 2007, 12:35 UTC · re: Johannes Schindelin · lore

Re: 'git diff' in rebase--interactive

Johannes Schindelin schrieb:
Show 7 quoted lines
> On Tue, 9 Oct 2007, Johannes Sixt wrote:
> 
>> I wonder for what reason rebase--interactive generates a patch using 
>> 'git diff' in the make_patch function. Is this an artefact?
> 
> It was an explicit request by people who use git-rebase regularly, and 
> missed being able to see the patch in --interactive.

Can we generate the patch with plumbing, diff-{files,index,tree}? They by-pass any diff drivers.

Show 5 quoted lines
>> I'd like to get rid of this use of 'git diff' because it invokes 
>> external diff drivers, which is totally unwanted if the driver is 
>> interactive - like the 'windiff' thing that I posted a week ago.
> 
> So you do not want to be able to run git-rebase (without -i)?

It wouldn't work anyway in my use-case (versioned Word documents), but rebase -m and rebase -i could run without manual intervention as long as there are no content merges.

In this particular case, I only wanted to amend the message of a commit 3 steps down in the history, and I had not expected any diff drivers to be fired up.

-- Hannes
Johannes Schindelin· Oct 9, 2007, 12:59 UTC · re: Johannes Sixt · lore

[PATCH] rebase -i: use diff plumbing instead of porcelain

When diff drivers are installed, calling "git diff <tree1>..<tree2>" calls those drivers. This borks the patch generation of rebase -i. So use "git diff-tree -p" instead, which does not call diff drivers.

Noticed by Johannes Sixt.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	On Tue, 9 Oct 2007, Johannes Sixt wrote:
	> Johannes Schindelin schrieb:
	> > On Tue, 9 Oct 2007, Johannes Sixt wrote:
	> > 
	> > > I wonder for what reason rebase--interactive generates a 
	> > > patch using 'git diff' in the make_patch function. Is this 
	> > > an artefact?
	> > 
	> > It was an explicit request by people who use git-rebase 
	> > regularly, and missed being able to see the patch in 
	> > --interactive.
	> 
	> Can we generate the patch with plumbing, 
	> diff-{files,index,tree}? They by-pass any diff drivers.
	Here you are.
 git-rebase--interactive.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 050140d..df4cedb 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -80,7 +80,7 @@ mark_action_done () {
 make_patch () {
 	parent_sha1=$(git rev-parse --verify "$1"^) ||
 		die "Cannot get patch for $1^"
-	git diff "$parent_sha1".."$1" > "$DOTEST"/patch
+	git diff-tree -p "$parent_sha1".."$1" > "$DOTEST"/patch
 	test -f "$DOTEST"/message ||
 		git cat-file commit "$1" | sed "1,/^$/d" > "$DOTEST"/message
 	test -f "$DOTEST"/author-script ||
@@ -325,7 +325,7 @@ do_next () {
 		;;
 	esac && {
 		test ! -f "$DOTEST"/verbose ||
-			git diff --stat $(cat "$DOTEST"/head)..HEAD
+			git diff-tree --stat $(cat "$DOTEST"/head)..HEAD
 	} &&
 	rm -rf "$DOTEST" &&
 	git gc --auto &&
-- 
1.5.3.4.1169.g5fb8d
Johannes Sixt· Oct 9, 2007, 14:26 UTC · re: Johannes Schindelin · lore

Re: [PATCH] rebase -i: use diff plumbing instead of porcelain

Johannes Schindelin schrieb:
> When diff drivers are installed, calling "git diff <tree1>..<tree2>"
> calls those drivers.  This borks the patch generation of rebase -i.
> So use "git diff-tree -p" instead, which does not call diff drivers.
Thanks a lot! That works much better.
-- Hannes

← back to recent threads