From: Adam Mercer <ramercer@gmail.com>
To: git@vger.kernel.org
Subject: Determining if a tree is clean
Date: Sat, 6 Mar 2010 09:12:42 -0600 [thread overview]
Message-ID: <799406d61003060712t120d7f11me6e2ab212c55271@mail.gmail.com> (raw)
Hi
In one of the projects I work in we have a script which creates a
header file containing various commit information, such as the id of
the HEAD commit, the date it was committed, who made the commit, and
if the tree is clean (i.e. no uncommitted changes). In order to
determine if the tree is clean we use the command
git diff-index --quiet HEAD
and if the this exits with a non-zero return code then we assume that
the tree is unclean. However I have found a case when this exits with
a return code of 1 when the tree has no uncommitted changes, e.g.:
$ git diff-index --quiet HEAD
$ echo $?
1
$
and when I look at what file it thinks is unclean I get:
$ git diff-index HEAD
:100644 100644 3b839718d3f182119db5d9e2b88e516e02ecc00b
0000000000000000000000000000000000000000 M
lal/include/lal/LALConfig.h.in
$ git diff-index -p HEAD
diff --git a/lal/include/lal/LALConfig.h.in b/lal/include/lal/LALConfig.h.in
$
which shows no changes in the actual file. This file is the template
for a header created using the AC_CONFIG_HEADERS() autoconf macro.
From the above it looks like the build process has created a new file
with exactly the same contents as the file specifies in the index. Is
there a way that I can tell git-diff-index that this is OK? Or is
there another way I can determine if the tree has any uncommitted
changes?
I'm seeing this with git-1.7, on Mac OS X 10.6, and git-1.5.5.6, on RHEL5.
Cheers
Adam
next reply other threads:[~2010-03-06 20:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 15:12 Adam Mercer [this message]
2010-03-06 19:23 ` Determining if a tree is clean Junio C Hamano
2010-03-06 20:33 ` Adam Mercer
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=799406d61003060712t120d7f11me6e2ab212c55271@mail.gmail.com \
--to=ramercer@gmail.com \
--cc=git@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).