# 'git diff' in rebase--interactive

5 messages from 2007-10-09 to 2007-10-09. Participants: Johannes Sixt, Johannes Schindelin.
Thread: https://gitlist.dev/t/10204

## Johannes Sixt, 2007-10-09 08:51

Subject: 'git diff' in rebase--interactive
Message-ID: <470B410F.1040506@viscovery.net>
URL: https://gitlist.dev/e/470B410F.1040506%40viscovery.net

```
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, 2007-10-09 12:22

Subject: Re: 'git diff' in rebase--interactive
Message-ID: <Pine.LNX.4.64.0710091319400.4174@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0710091319400.4174%40racer.site
In-Reply-To: <470B410F.1040506@viscovery.net>

```
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, 2007-10-09 12:35

Subject: Re: 'git diff' in rebase--interactive
Message-ID: <470B7581.3030301@viscovery.net>
URL: https://gitlist.dev/e/470B7581.3030301%40viscovery.net
In-Reply-To: <Pine.LNX.4.64.0710091319400.4174@racer.site>

```
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.

>> 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, 2007-10-09 12:59

Subject: [PATCH] rebase -i: use diff plumbing instead of porcelain
Message-ID: <Pine.LNX.4.64.0710091353140.4174@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0710091353140.4174%40racer.site
In-Reply-To: <470B7581.3030301@viscovery.net>

```

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, 2007-10-09 14:26

Subject: Re: [PATCH] rebase -i: use diff plumbing instead of porcelain
Message-ID: <470B8FA9.3090600@viscovery.net>
URL: https://gitlist.dev/e/470B8FA9.3090600%40viscovery.net
In-Reply-To: <Pine.LNX.4.64.0710091353140.4174@racer.site>

```
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

```
