Commit 2393f13b1ef9d6ffba0dba485d77acf0652f160c

Stefan Sperling 2018-03-09T15:36:55

support an absolute repos path argument in got_repo_open()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/lib/repository.c b/lib/repository.c
index 97e57a0..677e411 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -114,8 +114,12 @@ got_repo_open(struct got_repository **ret, const char *path)
 {
 	struct got_repository *repo = NULL;
 	const struct got_error *err = NULL;
-	char *abspath = got_path_get_absolute(path);
+	char *abspath;
 
+	if (got_path_is_absolute(path))
+		abspath = strdup(path);
+	else
+		abspath = got_path_get_absolute(path);
 	if (abspath == NULL)
 		return got_error(GOT_ERR_BAD_PATH);