[lkml]   [2021]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3/5] scripts/setlocalversion: add more comments to -dirty flag detection
This script stumbled on the read-only source tree over again:

- a2bb90a08cb3 ("kbuild: fix delay in setlocalversion on readonly

- cdf2bc632ebc ("scripts/setlocalversion on write-protected source

- 8ef14c2c41d9 ("Revert "scripts/setlocalversion: git: Make -dirty
check more robust"")

- ff64dd485730 ("scripts/setlocalversion: Improve -dirty check with
git-status --no-optional-locks")

Add comments to clarify that this script should never ever try to write
to the source tree.

'git describe --dirty' might look as a simple solution for appending
the -dirty string, but we cannot use it because it creates the
.git/index.lock file.

Signed-off-by: Masahiro Yamada <>

scripts/setlocalversion | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index f3084d6bbb22..6865df6699c8 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -80,6 +80,10 @@ scm_version()

# Check for uncommitted changes.
+ # This script must avoid any write attempt to the source tree,
+ # which might be read-only.
+ # You cannot use 'git describe --dirty' because it tries to
+ # create .git/index.lock .
# 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
 \ /
  Last update: 2021-05-23 05:16    [W:0.081 / U:3.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site