From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbbCJXDm (ORCPT ); Tue, 10 Mar 2015 19:03:42 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:34540 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbbCJXDi (ORCPT ); Tue, 10 Mar 2015 19:03:38 -0400 From: Gregory Fong To: linux-kernel@vger.kernel.org Cc: Michal Marek , Gregory Fong Subject: [PATCH] scripts/setlocalversion: fix false positive -dirty tag from ctime Date: Tue, 10 Mar 2015 16:03:09 -0700 Message-Id: <1426028589-28403-1-git-send-email-gregory.0xf0@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org git-diff-index cannot detect that a file hasn't actually changed when the file's ctime has changed (e.g. if chmod was used but didn't actually result in any changes), which was causing setlocalversion to incorrectly add a -dirty tag. Run git-update-index beforehand to make sure that the index is correct. Signed-off-by: Gregory Fong --- Quick test: make defconfig make prepare chmod u+w Kbuild # any chmod that doesn't result in a change will do CONFIG_LOCALVERSION_AUTO=y /bin/sh scripts/setlocalversion $PWD | grep -q dirty && echo "FAIL" || echo "OK" scripts/setlocalversion | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 63d91e2..9e97364 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -45,6 +45,8 @@ scm_version() # Check for git and a git repo. if test -z "$(git rev-parse --show-cdup 2>/dev/null)" && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then + # Update the index + git update-index -q --refresh # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore # it, because this version is defined in the top level Makefile. -- 1.9.1