-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitdiff.sh
More file actions
executable file
·36 lines (29 loc) · 818 Bytes
/
gitdiff.sh
File metadata and controls
executable file
·36 lines (29 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#
# Make a diff between two GIT trees.
# Copyright (c) Petr Baudis, 2005
#
# Takes two parameters identifying the two trees/commits to compare.
# Empty string will be substitued to HEAD revision.
#
# -p instead of the first parameter denotes a parent revision
# to the second id (which must not be a tree, obviously).
#
# Outputs a diff converting the first tree to the second one.
id1=$1
id2=$2
if [ "$id1" = "-p" ]; then
id1=$(parent-id "$id2")
fi
if [ ! "$id1" ] && [ ! "$id2" ]; then
# FIXME: We should squeeze gitdiff-do-alike output from this.
./show-d
exit
fi
id1=$(gitXnormid.sh "$id1") || exit 1
id2=$(gitXnormid.sh "$id2") || exit 1
if [ "$id1" = "$id2" ]; then
echo "gitdiff.sh: trying to diff $id1 against itself" >&2
exit 1
fi
diff-tree -r $id1 $id2 | xargs -0 gitdiff-do $id1 $id2