3 # Copyright (c) Josef "Jeff" Sipek, 2007-2013
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename "$0"` directly is no longer supported." >&2
20 bottompatch
=$
(head_n
1 < "$applied")
21 if [ -z "$bottompatch" ]; then
22 echo "No patch applied." >&2
26 base
=`git rev-parse "refs/patches/${branch}/${bottompatch}^"`
28 if [ -z "$patchname" ]; then
29 top
=`git rev-parse HEAD`
31 top
=`grep "^$patchname$" "$applied"`
32 if [ -z "$top" ]; then
33 die
"Cannot find patch '$patchname'. Is it applied?"
39 git diff-tree
-r "$1^" "$1" |
tr '\t' ' ' | cut
-d' ' -f6
42 cache
="$GUILT_DIR/$branch/.graphcache.$$"
44 trap "rm -rf \"$cache\"" 0
50 safebranch
=`echo "$branch"|sed 's%/%\\\\/%g'`
51 while [ "$current" != "$base" ]; do
52 pname
=`git show-ref | sed -n -e "
53 /^$current refs\/patches\/$safebranch/ {
54 s:^$current refs/patches/$branch/::
58 [ -z "$pname" ] && pname
="?"
60 pname
="`printf \"%s\" \"$pname\" | sed 's/\"/\\\\\"/g'`"
62 disp
"# checking rev $current"
63 disp
" \"$current\" [label=\"$pname\"]"
69 getfiles
$current |
while read f
; do
71 fh
=`echo "$f" | sha1 | cut -d' ' -f1`
72 if [ -e "$cache/$fh" ]; then
73 # ok, something already touched this file before us
74 cat "$cache/$fh" >> "$cache/dep"
76 echo "$current" > "$cache/$fh"
79 sort -u "$cache/dep" |
while read h
; do
80 disp
" \"$h\" -> \"$current\"; // ?"
83 current
=`git rev-parse $current^`