From: Ramkumar Ramachandra <artagnon@gmail.com>
To: "Dirk Süsserott" <newsletter@dirk.my1.cc>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Best way to check for a "dirty" working tree?
Date: Sun, 12 Jun 2011 17:53:13 +0530 [thread overview]
Message-ID: <BANLkTi=-HA1_47DvtGbVHx8twuEAxT8STQ@mail.gmail.com> (raw)
In-Reply-To: <4DF381BF.3050301@dirk.my1.cc>
Hi Dirk,
Dirk Süsserott writes:
> A) if ! git diff-index --quiet HEAD -- foo.bar; then
> dirty=1
> fi
>
> and
>
> B) if ! git diff --quiet -- foo.bar; then
> dirty=1
> fi
>
> Both A) and B) work. But which one is better/faster/more reliable? Or is
> there a better solution? For my purpose, I cannot see a difference
> between diff and diff-index, except the syntax.
diff is a more porcelain'ish command, while diff-index is closer to
the plumbing. Therefore, diff contains some extra argument parsing/
pretty printing code that your script doesn't utilize -- use
diff-index. Also, look at the various scripts in git.git to see what
they use; for example, require_clean_work_tree in git-sh-setup.sh.
-- Ram
next prev parent reply other threads:[~2011-06-12 12:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-11 14:54 Best way to check for a "dirty" working tree? Dirk Süsserott
2011-06-12 12:23 ` Ramkumar Ramachandra [this message]
2011-06-13 22:22 ` Jonathan Nieder
2011-06-14 13:28 ` Dirk Süsserott
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='BANLkTi=-HA1_47DvtGbVHx8twuEAxT8STQ@mail.gmail.com' \
--to=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=newsletter@dirk.my1.cc \
/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).