#!/bin/sh -e
#
# gstamp - print a stamp with machine,directory,date,hash of current git commit

print() { printf '%s\n' "$*"; }

host="$(hostname | cut -d. -f1)"
fpwd() { pwd | sed -e "s|^${HOME}|~|" -e 's-\([^/.]\)[^/]*/-\1/-g'; }
pwd="$(fpwd)"
today="$(date "+%Y-%m-%d %H:%M:%S")"
hash="$(git log --pretty=format:"%H %d" | grep HEAD | cut -d " " -f 1)"

print "# ${host}"
print "# ${pwd}"
print "# ${today}"
print "# ${hash}"
