Commit d4a5a8855b74b1a8d44747715e9545e53d7e6634

Stefan Sperling 2017-11-05T17:32:11

simplify get_refs_dir_path()

diff --git a/lib/refs.c b/lib/refs.c
index a51fefd..19e8815 100644
--- a/lib/refs.c
+++ b/lib/refs.c
@@ -150,15 +150,11 @@ done:
 static char *
 get_refs_dir_path(struct got_repository *repo, const char *refname)
 {
-	/* Some refs live in the .git directory. */
 	if (strcmp(refname, GOT_REF_HEAD) == 0 ||
 	    strcmp(refname, GOT_REF_ORIG_HEAD) == 0 ||
 	    strcmp(refname, GOT_REF_MERGE_HEAD) == 0 ||
-	    strcmp(refname, GOT_REF_FETCH_HEAD) == 0)
-		return got_repo_get_path_git_dir(repo);
-
-	/* Is the ref name relative to the .git directory? */
-	if (strncmp(refname, "refs/", 5) == 0)
+	    strcmp(refname, GOT_REF_FETCH_HEAD) == 0 ||
+	    strncmp(refname, "refs/", 5) == 0)
 		return got_repo_get_path_git_dir(repo);
 
 	return got_repo_get_path_refs(repo);