Commit 6876e2035e5226e05e591587b31ab2a9b477034b

Stefan Sperling 2019-07-22T10:38:36

remove another pointless call to got_path_normalize()

diff --git a/lib/repository.c b/lib/repository.c
index 39c436e..6ea6d7b 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -329,7 +329,7 @@ got_repo_open(struct got_repository **repop, const char *path)
 {
 	struct got_repository *repo = NULL;
 	const struct got_error *err = NULL;
-	char *abspath, *normpath = NULL;
+	char *abspath;
 	int i, tried_root = 0;
 
 	*repop = NULL;
@@ -370,13 +370,12 @@ got_repo_open(struct got_repository **repop, const char *path)
 	if (err)
 		goto done;
 
-	normpath = got_path_normalize(abspath);
-	if (normpath == NULL) {
-		err = got_error(GOT_ERR_BAD_PATH);
+	path = realpath(abspath, NULL);
+	if (path == NULL) {
+		err = got_error_from_errno2("realpath", path);
 		goto done;
 	}
 
-	path = normpath;
 	do {
 		err = open_repo(repo, path);
 		if (err == NULL)
@@ -400,7 +399,6 @@ done:
 	else
 		*repop = repo;
 	free(abspath);
-	free(normpath);
 	return err;
 }