jmou/zit
git clone https://github.com/jmou/zit.git
git clone git@github.com:jmou/zit.git
Loading…
(top)/get-sha1-basic
language: Shell
247 Bytes / 9 lines / 8 loc
History
View raw
#!/bin/bash -e
# this is not an actual git subcommand but implements a C function

# sha1_name.c:get_sha1_basic
if [[ ${#1} -eq 40 ]]; then
    echo $1
else
    cat .zit/$(symbolic-ref $1) 2> /dev/null || cat .zit/$(symbolic-ref refs/heads/$1)
fi