diff options
| author | Vicent Martà <vicent@github.com> | 2012-11-23 15:19:47 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-11-23 15:19:47 -0800 |
| commit | c4d8df27bc4d3c0ef5ea46f4953614955fc4bdc2 (patch) | |
| tree | 62a1d39f547c562d71558309e6548783202d62dc /src/status.c | |
| parent | 28de452a4b7915f1bb0c6913c23c04d412b281c7 (diff) | |
| parent | 5cec896a3b7b85190a7862fb09f8ba20b2241f76 (diff) | |
| download | libgit2-c4d8df27bc4d3c0ef5ea46f4953614955fc4bdc2.tar.gz | |
Merge pull request #1097 from nulltoken/topic/head_tree_error
Make `git_repository_head_tree()` return error codes
Diffstat (limited to 'src/status.c')
| -rw-r--r-- | src/status.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/status.c b/src/status.c index b8c15ef92..b832cfe64 100644 --- a/src/status.c +++ b/src/status.c @@ -121,8 +121,10 @@ int git_status_foreach_ext( (err = git_repository__ensure_not_bare(repo, "status")) < 0) return err; - if ((err = git_repository_head_tree(&head, repo)) < 0) - return err; + /* if there is no HEAD, that's okay - we'll make an empty iterator */ + if (((err = git_repository_head_tree(&head, repo)) < 0) && + !(err == GIT_ENOTFOUND || err == GIT_EORPHANEDHEAD)) + return err; memset(&diffopt, 0, sizeof(diffopt)); memcpy(&diffopt.pathspec, &opts->pathspec, sizeof(diffopt.pathspec)); |
