Permalink
Browse files

tools/create-git-sha1.sh, algo/create-git-version-h.sh: more generic …

…generation of 'git-version.h'

See #1847.
  • Loading branch information...
magiraud committed May 23, 2017
1 parent 1621377 commit 9b27050fa2d5060d163ffd3ac84e908af4470b2e
Showing with 17 additions and 10 deletions.
  1. +1 −10 algo/create-git-version-h.sh
  2. +16 −0 tools/create-git-sha1.sh
View
11 algo/create-git-version-h.sh 100755 → 100644
@@ -1,12 +1,3 @@
#!/bin/sh
GITV_H=git-version.h
GITV_H_TMP=git-version.h.tmp
touch ${GITV_H}
git log -1 --pretty=format:'#define GIT_VERSION "%h (%cd)"' --date=short --abbrev-commit > ${GITV_H_TMP} 2> /dev/null
# Replace the file only when the new file is different
diff ${GITV_H} ${GITV_H_TMP} || mv ${GITV_H_TMP} ${GITV_H}
../tools/create-git-sha1.sh git-version.h "#define GIT_VERSION"
View
@@ -0,0 +1,16 @@
#!/bin/sh
# Create a file with the current sha1
# sh create-git-sha1.sh ../algo/git-version.h "#define GIT_VERSION"
# sh create-git-sha1.sh ../browser/js/git-sha1.js "git_sha1 ="
GITV_H=$1
GITV_H_TMP=${GITV_H}.tmp
PRETTY_PREFIX=$2
touch ${GITV_H}
git log -1 --pretty=format:"${PRETTY_PREFIX} \"%h (%cd)\"" --date=short --abbrev-commit > ${GITV_H_TMP} 2> /dev/null
# Replace the file only when the new file is different
diff ${GITV_H} ${GITV_H_TMP} || mv ${GITV_H_TMP} ${GITV_H}

0 comments on commit 9b27050

Please sign in to comment.