--- /dev/null
+#!/bin/bash
+
+die() {
+ echo $@
+ exit 1
+}
+
+if [ $# -eq 0 ]; then
+ echo "xg: locate a file in the source tree and display the full git log information."
+ echo "Usage: xg [filename-substring]"
+ echo "Example: xg /BlockReader.java"
+ echo "Example 2: xg test-patch"
+ echo
+ exit 1
+fi
+
+T=/tmp/$$.xg.tmp
+trap "rm -rf ${T}; exit" INT TERM EXIT
+find . -noleaf -xdev -name '*.java' -o -name '*.h' -o -name '*.c' \
+ -o -name '*.cpp' -o -name '*.cxx' -o -name '*.cc' -o -name '*.sh' | \
+ grep $@ > "${T}"
+LINES=$(wc -l "${T}" | awk '{print $1}')
+[ "${LINES}" -lt 1 ] && die "no results"
+if [ "${LINES}" -gt 1 ]; then
+ echo "multiple results: "
+ cat "${T}"
+ exit 1
+fi
+
+F=$(cat "${T}")
+git log --follow -p "${F}"