git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 examples

Thanks, 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
Previous: Junio C Hamano
Message 3 of 3 in “Determining if a tree is clean”
  1. Adam MercerMar 6, 2010
  2. Junio C HamanoMar 6, 2010
  3. Adam MercerMar 6, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.