From fe918f8a3157110ebec3c3fac5cc4e6d3d6038b2 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Fri, 30 Jun 2017 13:15:32 +0100 Subject: [PATCH] pkg: Run `git update-index --refresh` before `git diff-index`. Otherwise files which have an updated timestamp but no actual changes are marked as changes because `git diff-index` only uses the `lstat` result and not the actual file contents. Running `git update-index --refresh` updates the cache. Signed-off-by: Ian Campbell --- kernel/Makefile | 2 +- pkg/package.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 2c00fc9a1..fc4e1a6be 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -22,7 +22,7 @@ HASH_COMMIT?=HEAD # Setting this is only really useful with the show-tag target HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print $$3}') ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition -DIRTY=$(shell git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") +DIRTY=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") endif endif diff --git a/pkg/package.mk b/pkg/package.mk index f1592b563..350846778 100644 --- a/pkg/package.mk +++ b/pkg/package.mk @@ -7,7 +7,7 @@ HASH_COMMIT?=HEAD # Setting this is only really useful with the show-tag target HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print $$3}') ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition -DIRTY=$(shell git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") +DIRTY=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") endif endif