git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git: how to produce context diffs?

From
TKThomas Kolejka <thomas.kolejka@gmx.at>
Date
Nov 27, 2006, 18:33 UTC
Message-ID
<20061127183346.30010@gmx.net>
In-Reply-To
<200611271516.30425.bruno@clisp.org>
Hello,
I'm using the following script 'external-diff.sh':

-- # path old-file old-hex old-mode new-file new-hex new-mode # $1 $2 $3 $4 $5 $6 $7

old_hex=$3 new_hex=`git-hash-object $5`

if [ "$old_hex" = "$new_hex" ]
then
	exit 0
fi

echo "diff --git a/$1 b/$1" echo "index ${old_hex:0:7}..${new_hex:0:7} $4"

diff -L a/$1 -L b/$1 -pc $2 $5

exit 0 --

which can be called by:

export GIT_EXTERNAL_DIFF=external-diff.sh git-diff-index master -p > my.patch

Bye, Thomas Kolejka

-- 
"Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's C
Previous: SeanNext: Junio C Hamano
Message 7 of 8 in “git: how to produce context diffs?”
  1. Bruno HaibleNov 27, 2006
  2. Jakub NarebskiNov 27, 2006
  3. SeanNov 27, 2006
  4. Jakub NarebskiNov 27, 2006
  5. SeanNov 27, 2006
  6. SeanNov 27, 2006
  7. Thomas KolejkaNov 27, 2006
  8. Junio C HamanoNov 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.