3 # Copyright (c) Josef "Jeff" Sipek, 2007-2013
6 USAGE
="[-x exclude-pattern]... [<patchname>]"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename "$0"` directly is no longer supported." >&2
14 cache
="$GUILT_DIR/$branch/.graphcache.$$"
15 xclude
="$GUILT_DIR/$branch/.graphexclude.$$"
16 trap "rm -rf \"$cache\" \"$xclude\"" 0
20 while [ $# -gt 0 ]; do
21 if [ "$1" = "-x" ] && [ $# -ge 2 ]; then
22 echo "$2" >> "$xclude"
36 bottompatch
=$
(head_n
1 < "$applied")
37 if [ -z "$bottompatch" ]; then
38 echo "No patch applied." >&2
42 base
=`git rev-parse "refs/patches/${branch}/${bottompatch}^"`
44 if [ -z "$patchname" ]; then
45 top
=`git rev-parse HEAD`
47 top
=`grep "^$patchname$" "$applied"`
48 if [ -z "$top" ]; then
49 die
"Cannot find patch '$patchname'. Is it applied?"
55 git diff-tree
-r "$1^" "$1" | cut
-f2
62 safebranch
=`echo "$branch"|sed 's%/%\\\\/%g'`
63 while [ "$current" != "$base" ]; do
64 pname
=`git show-ref | sed -n -e "
65 /^$current refs\/patches\/$safebranch/ {
66 s:^$current refs/patches/$branch/::
70 [ -z "$pname" ] && pname
="?"
72 pname
="`printf \"%s\" \"$pname\" | sed 's/\"/\\\\\"/g'`"
74 disp
"# checking rev $current"
75 disp
" \"$current\" [label=\"$pname\"]"
81 getfiles
$current |
grep -v -f "$xclude" |
while read f
; do
83 fh
=`echo "$f" | sha1 | cut -d' ' -f1`
84 if [ -e "$cache/$fh" ]; then
85 # ok, something already touched this file before us
86 cat "$cache/$fh" >> "$cache/dep"
88 echo "$current" > "$cache/$fh"
91 sort -u "$cache/dep" |
while read h
; do
92 disp
" \"$h\" -> \"$current\"; // ?"
95 current
=`git rev-parse $current^`