Source

git-pastiche / bin / git-find-blob

Stefan Saasen 44b2324 













Stefan Saasen f0edb1a 


Stefan Saasen 44b2324 


Stefan Saasen 0358efd 
Stefan Saasen 44b2324 



#!/bin/sh

#
# Find the commits that contain the given object id
#

if [ $# -lt 1 ]; then
  echo "Usage: git find-blob SHA1 [git log options]"
  echo ""
  echo "    git find-blob 8e67180a935d28eba77ef1dbdb3daf5a837a67ac"
  echo ""
  exit -1
fi

set -u
set -e

blob="$1"
shift
    if git ls-tree -r $tree | grep -q "${blob}" ; then
git log "$@" --all --pretty=format:'%T %h %s' | while read tree commit subject ; do
        echo "${commit} ${subject}"
    fi
done

# vim: set filetype=sh