summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-11-14 15:08:49 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-11-14 15:08:46 -0800
commit01c47b8a7e64cc8c598aac10887e9ce328bbb2eb (patch)
treeeaf747311dc8ca2bac9d91520297cbf8f73a0f72 /scripts
parent39132a8d3352b23e333779ec68daec8d1ce853da (diff)
parent4547f0febbca55057d4249dd6e4e6d509dbc2e46 (diff)
Merge "Merge android-4.4-p.200 (903fbe7) into msm-4.4"
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