From: Marc Herbert <Marc.Herbert@intel.com>
To: Mike Mason <michael.w.mason@intel.com>
Cc: andy.work@nglowry.com, git@vger.kernel.org, gitster@pobox.com,
josh@joshtriplett.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, lists@nerdbynature.de,
peff@peff.net, nico-linuxsetlocalversion@schottelius.org
Subject: Re: Wrong -dirty suffix set by setlocalversion (was: BUG in git diff-index)
Date: Thu, 24 May 2018 20:50:28 -0700 [thread overview]
Message-ID: <0dc31052-4cfd-3b92-0a4a-96c8ecfafff6@intel.com> (raw)
In-Reply-To: <20180524230334.12452-1-michael.w.mason@intel.com>
On 24/05/2018 16:03, Mike Mason wrote:
> diff --git a/scripts/setlocalversion b/scripts/setlocalversion
> index 71f39410691b..9da4c5e83285 100755
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -73,8 +73,10 @@ scm_version()
> printf -- '-svn%s' "`git svn find-rev $head`"
> fi
>
> - # Check for uncommitted changes
> - if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
> + # Check for uncommitted changes. Only check mtime and size.
> + # Ignore insequential ctime, uid, gid and inode differences.
> + if git -c "core.checkstat=minimal" diff-index --name-only HEAD | \
> + grep -qv "^scripts/package"; then
> printf '%s' -dirty
> fi
FWIW:
Reported-by: Marc.Herbert@intel.com
Reviewed-by: Marc.Herbert@intel.com (assuming a future and decent commit message)
Tested-by: Marc.Herbert@intel.com
So the real use case is making a copy of a whole tree before building.
Typical in automated builds, old example:
https://groups.google.com/a/chromium.org/d/msg/chromium-os-dev/zxOa0OLWFkw/N_Sb7EZOBwAJ
Here's a more complex but faster and more transparent way to test Mike's fix
than copying an entire tree:
# Make sure you start from a clean state
git describe --dirty # must not -dirty
make prepare
# Simulate a copy of the tree but with just one file
rsync --perms --times README README.mtime_backup
rm README
rsync --perms --times README.mtime_backup README
stat README README.mtime_backup
# Demo the BUG fixed by Mike
./scripts/setlocalversion # -dirty BUG! because spurious inode ctime difference
git diff-index HEAD
git describe --dirty # not -dirty
./scripts/setlocalversion # not -dirty any more cause describe refreshed index
# Make sure mtime still causes -dirty with AND without Mike's fix
touch README
./scripts/setlocalversion # -dirty
prev parent reply other threads:[~2018-05-25 3:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <loom.20160331T143733-916@post.gmane.org>
[not found] ` <20160331140515.GA31116@sigill.intra.peff.net>
[not found] ` <CAJxkE8SVF_ikHqDCh6eHExq=seitHPVpxW2GmPo40jtqWvz1JQ@mail.gmail.com>
[not found] ` <20160331142704.GC31116@sigill.intra.peff.net>
[not found] ` <56FD7AE8.4090905@nglowry.com>
[not found] ` <xmqqwpoil6vt.fsf@gitster.mtv.corp.google.com>
2017-09-26 19:46 ` BUG in git diff-index Marc Herbert
2017-09-26 20:11 ` Eric Wong
2017-09-27 21:06 ` Wrong -dirty suffix set by setlocalversion (was: BUG in git diff-index) Marc Herbert
2018-05-24 23:03 ` Mike Mason
2018-05-25 3:50 ` Marc Herbert [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0dc31052-4cfd-3b92-0a4a-96c8ecfafff6@intel.com \
--to=marc.herbert@intel.com \
--cc=andy.work@nglowry.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=josh@joshtriplett.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
--cc=michael.w.mason@intel.com \
--cc=nico-linuxsetlocalversion@schottelius.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome