summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-10-22 12:33:49 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-10-27 16:13:09 -0700
commit68a26dfa7c61b6421d7a32176e83b36420b7201b (patch)
tree159267a731b008fce68031ffdda57c9e76511204
parentc2892d61acfe4ec1544a87e2455bb086bee96516 (diff)
downloadlibgit2-68a26dfa7c61b6421d7a32176e83b36420b7201b.tar.gz
status: reorder retrieve_head_tree error checks
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
-rw-r--r--src/status.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/status.c b/src/status.c
index 7449335c2..bda4ec59a 100644
--- a/src/status.c
+++ b/src/status.c
@@ -142,16 +142,14 @@ static int retrieve_head_tree(git_tree **tree_out, git_repository *repo)
*tree_out = NULL;
error = git_repository_head(&resolved_head_ref, repo);
- if (error != GIT_SUCCESS && error != GIT_ENOTFOUND)
- return git__rethrow(error, "HEAD can't be resolved");
-
/*
* We assume that a situation where HEAD exists but can not be resolved is valid.
* A new repository fits this description for instance.
*/
-
if (error == GIT_ENOTFOUND)
return GIT_SUCCESS;
+ if (error < GIT_SUCCESS)
+ return git__rethrow(error, "HEAD can't be resolved");
if ((error = git_commit_lookup(&head_commit, repo, git_reference_oid(resolved_head_ref))) < GIT_SUCCESS)
return git__rethrow(error, "The tip of HEAD can't be retrieved");