source: git/git-version-gen @ 2e553a

spielwiese
Last change on this file since 2e553a was 2e4ee2b, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Minor improvement to git-version-gen
  • Property mode set to 100755
File size: 508 bytes
Line 
1#!/bin/bash
2
3GIT_WORK_TREE=`dirname "$0"`
4## :'%h on %ci by %an: "%s"' --abbrev-commit | sed 's/\"/\\\"/g'
5if [ -d "$GIT_WORK_TREE/.git" ] && v=`git log --pretty=format:'%h' --abbrev-commit -1 2>/dev/null` ;
6then
7 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" ];
8 then
9   echo -n "$v|$dirty"
10 else
11   echo -n "$v"
12 fi
13# exit 0
14else
15 F="$1"
16 if [ -r "$F" ];
17 then 
18   cat "$F"
19 else 
20   echo -n "UNKNOWN_GIT_VERSION"
21 fi 
22fi
Note: See TracBrowser for help on using the repository browser.