source: git/git-version-gen @ 348e0e

spielwiese
Last change on this file since 348e0e was 348e0e, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Store and propagate the latest git commit + dirty status NOTE: one should use 'make dist' for generating a source tarball (starting with a git clone at the very beginning)
  • Property mode set to 100755
File size: 423 bytes
RevLine 
[348e0e]1#!/bin/bash
2
3GIT_WORK_TREE=`dirname "$0"`
4
5if [ -d "$GIT_WORK_TREE/.git" ] && v=`git log --pretty=format:'%h on %ci by %an: "%s"' --abbrev-commit -1 2>/dev/null | sed 's/\"/\\\"/g'`
6then
7 dirty=`sh -c "git diff-index --name-status HEAD 2>/dev/null | sed -e 's|^\([A-Z]\).*|\1|g' | tr -d '\012'"` && [ -n "$dirty" ] && echo -n "$v * $dirty"
8else
9 [ -r "$1" ] && cat "$1" && exit 0
10 echo -n "UNKNOWN_GIT_VERSION"
11fi
12
13
14exit 0
Note: See TracBrowser for help on using the repository browser.