]> git.baikalelectronics.ru Git - kernel.git/commit
scripts/setlocalversion: git: Make -dirty check more robust
authorGenki Sky <sky@genki.is>
Wed, 29 Aug 2018 03:26:24 +0000 (23:26 -0400)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 31 Aug 2018 16:21:42 +0000 (01:21 +0900)
commit0247c7807cac73203cec868b1e4f71a47f944e7b
tree24724166a187b2dd4b6e2bd7f3b65ee724624b17
parent0ff97265403d59a684be8666710156706ccfd8fa
scripts/setlocalversion: git: Make -dirty check more robust

$(git diff-index) relies on the index being refreshed. This refreshing
of the index used to happen, but was removed in 00a72fc920e0
("scripts/setlocalversion on write-protected source tree", 2013-06-14)
due to issues with a read-only filesystem.

If the index is not refreshed, one runs into problems. E.g. as
described in [0], git stores the uid in its index, so even if just the
uid has changed (or git is tricked into thinking so), then we will
think the tree is dirty. So as in [1], if you package linux-git with a
system that uses fakeroot(1), you get a "-dirty" version. Unless you
manually $(git update-index --refresh) themselves.

The simplest solution seems to be $(git status --porcelain), with an
additional flag saying "ignore untracked files". It seems clearer
about what it does, and avoids issues regarding cached indexes and
writable filesystems, but still has stable output for scripting.

[0]: https://public-inbox.org/git/0190ae30-b6c8-2a8b-b1fb-fd9d84e6dfdf@oracle.com/
[1]: https://bbs.archlinux.org/viewtopic.php?id=236702

Signed-off-by: Genki Sky <sky@genki.is>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/setlocalversion