minio/buildscripts/git-commit-id.sh
Anand Babu (AB) Periasamy 3c4aa85c69 git commit hash generator
2015-03-25 22:57:30 -07:00

20 lines
324 B
Bash

#!/usr/bin/env bash
CONST_FILE=build-constants.go
cat > $CONST_FILE <<EOF
/*
* ** DO NOT EDIT THIS FILE. THIS FILE IS AUTO GENERATED BY RUNNING MAKE **
*/
package main
const (
gitCommitHash = "__GIT_COMMIT_HASH__"
)
EOF
commit_id=$(git log --format="%H" -n 1)
sed -i "s/__GIT_COMMIT_HASH__/$commit_id/" $CONST_FILE