Skip to content

Commit

Permalink
scripts/setlocalversion: add more comments to -dirty flag detection
Browse files Browse the repository at this point in the history
This script stumbled on the read-only source tree over again:

 - a2bb90a ("kbuild: fix delay in setlocalversion on readonly
   source")

 - cdf2bc6 ("scripts/setlocalversion on write-protected source
   tree")

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

 - ff64dd4 ("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 <masahiroy@kernel.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Nico Schottelius <nico-linuxsetlocalversion@schottelius.org>
  • Loading branch information
Masahiro Yamada committed May 26, 2021
1 parent a2be76a commit ffaf62a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scripts/setlocalversion
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ scm_version()
fi

# 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
Expand Down

0 comments on commit ffaf62a

Please sign in to comment.