Skip to content

Instantly share code, notes, and snippets.

@tbnorth
Created August 18, 2014 01:06
Show Gist options
  • Save tbnorth/6f2611b0fe42faaba690 to your computer and use it in GitHub Desktop.
Save tbnorth/6f2611b0fe42faaba690 to your computer and use it in GitHub Desktop.
@language unknown_language
#!/bin/sh
# http://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommited-changes
if git diff-index --cached --quiet HEAD --ignore-submodules -- ; then
echo Version info script sees nothing to do
exit
fi
cat >leo/core/commit_timestamp.json << EOT
{
"asctime": "$(date)",
"timestamp": "$(date '+%Y%m%d%H%M%S')"
}
EOT
echo Updating version info
sleep 1
git add leo/core/commit_timestamp.json
@language unknown_language
#!/bin/sh
TS=$(grep timestamp leo/core/commit_timestamp.json | sed 's/.*: "//; s/"//')
echo >> "$1"
echo Leo build: $TS >> "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment