diff options
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)); |
