diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2014-07-31 12:50:57 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2014-07-31 12:51:38 +0200 |
commit | bcc7a47121e63d6d448f0696028756b03b2da58a (patch) | |
tree | d4248dd338d2dc7d7e4567b1b715115011c6775f /scripts | |
parent | 745c167cd264fd197580fbcb251177ef74b3671f (diff) | |
download | ptxdist-bcc7a47121e63d6d448f0696028756b03b2da58a.tar.gz ptxdist-bcc7a47121e63d6d448f0696028756b03b2da58a.tar.xz |
setlocalversion: not all git version support the '-c' option
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel/setlocalversion | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion index 8546eefc1..3feb87dce 100755 --- a/scripts/kernel/setlocalversion +++ b/scripts/kernel/setlocalversion @@ -45,8 +45,13 @@ fi cd "$(dirname "${tarball_version_file}")" +git_abbrev= +if git -h 2>&1 | grep -q -- '-c\>'; then + git_abbrev="-c core.abbrev=12" +fi + # Check for git and a git repo. -if head=`git -c core.abbrev=12 rev-parse --verify --short HEAD 2>/dev/null`; then +if head=`git ${git_abbrev} rev-parse --verify --short HEAD 2>/dev/null`; then # If we are at a tagged commit (like "ptxdist-2010.05.0"), we # print it here @@ -55,7 +60,7 @@ if head=`git -c core.abbrev=12 rev-parse --verify --short HEAD 2>/dev/null`; the # If we are past a tagged commit (like "ptxdist-2010.03.0-130-g3c60777"), # we pretty print it. - elif atag="`git -c core.abbrev=12 describe 2>/dev/null`"; then + elif atag="`git ${git_abbrev} describe 2>/dev/null`"; then echo "$atag" | awk -F- '{printf("%s-%05d-%s", $(NF-2),$(NF-1),$(NF))}' # If we don't have a tag at all we print ????.??.?-?-g{commitish}. |