Skip to contentSkip to conversation

'git diff' in rebase--interactive

PATCH In review Johannes Sixt 2 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Hi,

Quoted 2 lines · Johannes Sixt

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.

Quoted 3 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)?

Ciao,
Dscho

#2 lore raw
Quoted 5 lines · Johannes Schindelin
Quoted 1 line · Johannes Sixt

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.

Quoted 3 lines
Quoted 1 line

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

#3 lore raw

PATCH 1/1 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.

---

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(-)
git-rebase--interactive.sh +2 -2
index 050140d..df4cedb 100755
@@ -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 &&
Signature · 1 line
1.5.3.4.1169.g5fb8d
#4 lore raw

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

Quoted 3 lines · Johannes Schindelin

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