Commit f2db9c479fbdf8dfb2f58619e6e62781117a14b8

Stefan Sperling 2019-08-24T22:14:29

don't mask "not a git repo" errors in got_repo_open()

diff --git a/lib/repository.c b/lib/repository.c
index f7044b4..597eaa8 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -397,13 +397,15 @@ got_repo_open(struct got_repository **repop, const char *path)
 		if (path[0] == '/' && path[1] == '\0') {
 			if (tried_root) {
 				err = got_error(GOT_ERR_NOT_GIT_REPO);
-				break;
+				goto done;
 			}
 			tried_root = 1;
 		}
 		path = dirname(path);
-		if (path == NULL)
+		if (path == NULL) {
 			err = got_error_from_errno2("dirname", path);
+			goto done;
+		}
 	} while (path);
 
 	err = get_path_gitconfig(&gitconfig_path, repo);