libgit2/libgit2 — pull request #1814 by jspahrsummers (2013-08-29 05:58:57+00:00)
Title: Fix incorrect precedence within git_repository_is_empty()

The correct logic checks whether HEAD is symbolic, assigns the result of that check to `error`, then fails if it's zero (i.e., HEAD is not symbolic).

#1728 introduced a subtle change to the precedence, causing it to assign the result of `git_reference_type()` to `error`. Since all of the `git_ref_t` values are non-negative, `git_repository_is_empty()` could bail out with an erroneously positive value.

This was caught (unintentionally) by surprising unit test failures in libgit2/objective-git#238.

@ivoire @vmg