Unnamed paste

pasted by Unknown [options]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
get_sha1 () 
{ 
    ( local f;
    f=$(readlink -f "${1:-.}");
    if [[ -d $f ]]; then
        cd "$f" || return 1;
        git log -n1 --pretty="format:%H" .;
    else
        cd "${f%/*}" || return 1;
        git ls-tree HEAD -- "${f##*/}" | awk '{print $3}';
    fi )
}