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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Schindelin
Date: Tuesday, October 9, 2007 - 5:59 am

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
'git diff' in rebase--interactive, Johannes Sixt, (Tue Oct 9, 1:51 am)
Re: 'git diff' in rebase--interactive, Johannes Schindelin, (Tue Oct 9, 5:22 am)
Re: 'git diff' in rebase--interactive, Johannes Sixt, (Tue Oct 9, 5:35 am)
[PATCH] rebase -i: use diff plumbing instead of porcelain, Johannes Schindelin, (Tue Oct 9, 5:59 am)