summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-12-06 12:51:54 -0800
committerLinux Build Service Account <lnxbuild@localhost>2019-12-06 12:51:54 -0800
commit33dc678e7692f04ecc1eeddeb1cca8a809bc1727 (patch)
tree7ac214cbb1f5256e0738cd6423f01e364b942bd4 /scripts
parentfeb565e67fc2b2f2a95890577120141be5886594 (diff)
parent72078891843ce0d5b8e95040d09ba92913916af9 (diff)
Merge 72078891843ce0d5b8e95040d09ba92913916af9 on remote branch
Change-Id: I219a5f0e8bd6ee3be3ba0d49230dde908d35dc25
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/setlocalversion12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 91ba51dd88ef..1bbde3a91099 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -87,8 +87,16 @@ scm_version()
printf -- '-svn%s' "`git svn find-rev $head`"
fi
- # Check for uncommitted changes
- if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
+ # Check for uncommitted changes.
+ # First, with git-status, but --no-optional-locks is only
+ # supported in git >= 2.14, so fall back to git-diff-index if
+ # it fails. Note that git-diff-index does not refresh the
+ # index, so it may give misleading results. See
+ # git-update-index(1), git-diff-index(1), and git-status(1).
+ if {
+ git --no-optional-locks status -uno --porcelain 2>/dev/null ||
+ git diff-index --name-only HEAD
+ } | grep -qvE '^(.. )?scripts/package'; then
printf '%s' -dirty
fi