Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: vcs_info git: Fix stagedstr for empty repos



At 02:26 +0000 01 Jun 2014, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
'diff-index --cached --quiet $empty_tree' is an O(1) operation, but I am not sure whether it is forwards compatible with future versions of Git, i.e., whether it's a hack that happens to work or a legitimate use of git's API.

git itself does that comparison in several places, including in the sample pre-commit hook that is shipped with it. So I'd say that that behavior is highly unlikely to change. Many of those places, including that sample hook actually hard-code the sha1 for the empty tree as 4b825dc642cb6eb9a060e54bf8d69288fbee4904.



Messages sorted by: Reverse Date, Date, Thread, Author