Re: git: how to produce context diffs?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 Cup-Yacht!
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]