> From: Paul E. McKenney <paulmck@xxxxxxxxxx> > ... > > > Here is one way to script this, where "SHA" identifies the commit to > > > be checked and PATHS the affected pathnames: > > > > > > git checkout SHA^ > > > git show SHA | git apply - > > > git blame -M PATHS | grep '^0* ' > > > > Cool ~. Thank you, Paul. > > I took them and made them into a script below for future use ;-) > > Nice!!! > > > #!/bin/bash > > > > SHA=$1 > > > > if [ -z "$SHA" ]; then > > echo "Usage: $0 <commit-id>" > > exit 1 > > fi > > > > if ! git cat-file -t "$SHA" &> /dev/null; then > > echo "$SHA does not exist in the repository" > > exit 1 > > fi > > You might want to record the current position so that you can return to it > automatically. One approach is to parse the output of "git status". > > > git checkout ${SHA}^ &> /dev/null > > git show ${SHA} | git apply - &> /dev/null > > > > PATHS=`git status| grep "modified:" | cut -d: -f2 | xargs` > > The '--porcelain' argument makes 'git status' is a bit easier to parse robustly. > > > for P in ${PATHS}; do > > R=`git blame -M $P | grep '^0* '` > > You can avoid any bash-variable length limitations by using 'grep -q' and > capturing the exit status using "$?". > Thank you, Paul, for all the enhancement suggestions. ;-) > Thanx, Paul > > ...