Re: Determining if a tree is clean
- From
Adam Mercer <ramercer@gmail.com>
- Date
- Mar 6, 2010, 20:33 UTC
- Message-ID
- <799406d61003061233w60633e26t4c2434042b7f216d@mail.gmail.com>
- In-Reply-To
- <7vy6i5fe5h.fsf@alter.siamese.dyndns.org>
On Sat, Mar 6, 2010 at 13:23, Junio C Hamano <gitster@pobox.com> wrote:
> It is expected that a Porcelain script that implements a custom feature > may call diff-files, diff-index and other plumbing commands many times > during its lifetime, and that it knows what it is doing (namely, when > it touches the working tree itself and why).
Makes sense.
Show 7 quoted lines
> Your Porcelain script should look something like:
>
> git update-index --refresh
> git diff-files -q || { echo "modified working tree"; exit 1 }
> git diff-index --cached -q HEAD || { echo "modified index"; exit 2 }
>
> See contrib/examples/*.sh for examplesThanks, Junio. That does the trick, I'd recently found the update-index command and had run into the problem (but not the solution) that the call to diff-files addresses.
Cheers
Adam