--- /dev/null
+#!/bin/bash
+#
+# Assumes a lot about invocation:
+# commit1 commit2 -- path
+
+EXT="${4##*.}"
+
+case "$EXT" in
+ png|jpg|bmp)
+ F1=$(mktemp --suffix=$EXT)
+ git cat-file -p $1:$4 > $F1
+ F2=$(mktemp --suffix=$EXT)
+ git cat-file -p $2:$4 > $F2
+ montage $F1 $F2 -tile 2x1 -geometry +5+5 -border 2 png:- | display -
+ rm -f $F1 $F2
+ ;;
+ *)
+ git meld $*
+ ;;
+esac
--- /dev/null
+#!/bin/zsh
+#
+# Review commits based on the branch graph
+#
+
+N=1
+if [ $# = 1 ] ; then
+ if [ -e $1 ] ; then
+ FOCUS=$1
+ else
+ N=$1
+ fi
+elif [ $# = 2 ] ; then
+ N=$1
+ FOCUS=$2
+fi
+FMT='--pretty=format:<s:%h>%h %d %s'
+
+GRAPH="$(git log --graph --full-history "$FMT" --all $FOCUS )"
+
+PROJECT="$(git rev-parse --show-toplevel| sed 's/.*\///')"
+
+X=$(echo "$GRAPH" | iselect -t "$PROJECT" -n git-review -p $N -P -K -k/ -kp )
+
+[ -z "$X" ] && exit 0
+X=( ${(s[:])X} )
+N=$X[1]
+K=$X[2]
+X=$X[3]
+if [ "$K" = / ] ; then
+ read "x?Search: "
+ N=${"$(echo "$GRAPH" | grep -nF "$x")"%%:*}
+elif [ "$K" = "p" ] ; then
+ # previous commit
+ Z=${"$(git rev-parse ${X}~1)"[1,7]}
+ [ -z "$Z" ] || N=${"$(echo "$GRAPH" | grep -nF "$Z")"%%:*}
+else
+ FOCUS=$FOCUS git-show-i $X~1 $X
+fi
+exec $0 $N $FOCUS
--- /dev/null
+#!/bin/zsh
+#
+# Show differences between $1 and $2 with selection
+
+TMP=/tmp/git-show-i-$$
+mkdir -p $TMP
+function cleanup() {
+ rm -rf $TMP
+ trap "" 0
+ exit
+}
+trap "cleanup" 0 2 15
+
+git diff --no-prefix $* 2>/dev/null | \
+ csplit -z -b %04d -f $TMP/hunk# - "/^diff --git/" "{*}" > /dev/null
+
+if [ ! -f $TMP/hunk#0000 ] ; then
+ read 'x?Push enter'
+ exit 0
+fi
+
+LIST=( ${(f)"$(head -qn1 $TMP/* 2>/dev/null | awk '{print "<s>" $3;}')"} )
+
+if [ -z "$LIST" ] ; then
+ read 'x?Nothing to show. Push enter'
+ exit 0
+fi
+
+# translate a given selection index, if for a submodule, into the
+# commit ids for the submodule
+function submodule_delta() {
+ # Determine which diff-hunk is selected
+ HUNK="$(grep -lF "diff --git $1 " $TMP/* )"
+ # If the hunk ends with "+Subproject commit ", then it's a sub project
+ tail -n 2 $HUNK | grep "^.Subproject commit " | sed 's/.* //'
+}
+
+PROJECT="$(git rev-parse --show-toplevel| sed 's/.*\///')"
+if [ -n "$FOCUS" ] ; then
+ # point at the focused item
+ LAST=${$(echo "${(F)LIST}" | grep -nF "<s>$FOCUS")%%:*}
+fi
+[ -z "$LAST" ] && LAST=1
+while true ; do
+ X="$(iselect -f -n "git-show-i" -K -t "$PROJECT: commit $1" -p $LAST \
+ $LIST "<s>Done" )"
+ [ -z "$X" ] && break
+ LAST=${$(echo "${(F)LIST}" | grep -nF "<s>${X#*:}")%%:*}
+ #read "x?$LAST $X"
+ case "${X%%:*}" in
+ RETURN|KEY_RIGHT)
+ [ "${X#*:}" = Done ] && exit 0
+ # If the selection is a sub module, then use git-show-i
+ # recursively for the submodule versions
+ SUBS=( $(submodule_delta "${X#*:}" ) )
+ if [ -z "$SUBS" ] ; then
+ #git meld $* -- "${X#*:}"
+ git-differ $* -- "${X#*:}"
+ else
+ ( cd ${X#*:} ; $0 $SUBS )
+ fi
+ continue
+ ;;
+ esac
+done