[3ebd22]: gitrev.sh Maximize Restore History

Repo status: analyzing...

Download this file

gitrev.sh    16 lines (15 with data), 278 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/bin/sh
N=0
R=""
MAX=50
while [ $N -le $MAX ] && [ "x$R" = "x" ]
do
R=$(git log -1 --pretty=format:%b HEAD~$N | awk '$2 ~ /@([0-9]+)$/ {sub(".*@", "", $2); print $2}')
N=$(($N+1))
done
if [ "x$R" != "x" ]; then
if [ $N -gt 1 ]; then
R=$R\+$((N-1))
fi
echo $R
fi