libgit2/objective-git — pull request #53 by rowanj (2011-12-27 03:37:25+00:00)
Title: Fix `NSString` exception in `NSError+Git`

`git_lasterror()` may return NULL, which causes an exception in `[NSString stringWithUTF8String:]`

i.e. if `GTRepository - (id)initWithURL:(NSURL *)localFileURL error:(NSError **)error` is called with a `file://` URL that doesn't exist, the `git_repository_open(...)` call will fail with code `GIT_EOSERR`, which indicates that the operating system error codes should be checked.

We fix this case by using the result of `strerror(errno)` if:

* `git_lasterror()` returned `NULL` AND
* The error `code` is `GIT_EOSERR`

This returns "No such file or directory" in the case given.