source: git/git-version-gen @ 1a1f34b

spielwiese
Last change on this file since 1a1f34b was 75f460, checked in by Hans Schoenemann <hannes@…>, 9 years ago
format
  • Property mode set to 100755
File size: 548 bytes
Line 
1#!/bin/bash
2
3export GIT_WORK_TREE=`dirname "$0"`
4export GIT_DIR="$GIT_WORK_TREE/.git"
5
6## :'%h on %ci by %an: "%s"' --abbrev-commit | sed 's/\"/\\\"/g'
7if [ -d "$GIT_WORK_TREE/.git" ] && v=`git log --pretty=format:'%h' --abbrev-commit -1 2>/dev/null` ;
8then
9 if dirty=`sh -c "git diff-index --name-status HEAD 2>/dev/null | sed -e 's|^\([A-Z]\).*|\1|g' | tr -d '\012'"` && [ -n "$dirty" ];
10 then
11   echo -n "$v|$dirty"
12 else
13   echo -n "$v"
14 fi
15# exit 0
16else
17 F="$1"
18 if [ -r "$F" ];
19 then
20   cat "$F"
21 else
22   echo -n "UNKNOWN_GIT_VERSION"
23 fi
24fi
Note: See TracBrowser for help on using the repository browser.