: bharatvaj/scripts

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
#!/bin/sh

while read -r line; do
    case "$line" in
        x\ *) echo "$line" ;;
        [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\ *) echo "$line" ;;
        *)
            vdate="$(git log -S "$line" --reverse --format='%ad' --date=short | head -n1)"
            if [ -n "$vdate" ]; then
                echo "$vdate $line"
            else
                echo "$line"
            fi
            ;;
    esac
done < todo.txt