Re: Best way to check for a "dirty" working tree?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]