Commit Diff


commit - f43793a4e6eda593d67d4872bc7f03398fbd65d9
commit + e83c06347d9516d0180594769020b3013a232414
blob - 694024dff777495df250aba392c630bb04e3e65a
blob + 158483e7592b870d9c2e3ac5e44abea57616549f
--- lib/repository.c
+++ lib/repository.c
@@ -657,14 +657,10 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 {
 	const struct got_error *err = NULL;
 	const char *repo_abspath = NULL;
-	size_t repolen, cwdlen, len;
-	char *cwd, *canonpath, *path = NULL;
+	size_t repolen, len;
+	char *canonpath, *path = NULL;
 
 	*in_repo_path = NULL;
-
-	cwd = getcwd(NULL, 0);
-	if (cwd == NULL)
-		return got_error_from_errno("getcwd");
 
 	canonpath = strdup(input_path);
 	if (canonpath == NULL) {
@@ -684,7 +680,7 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 			goto done;
 		}
 	} else {
-		int is_repo_child = 0, is_cwd_child = 0;
+		int is_repo_child = 0;
 
 		path = realpath(canonpath, NULL);
 		if (path == NULL) {
@@ -705,13 +701,10 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 		}
 
 		repolen = strlen(repo_abspath);
-		cwdlen = strlen(cwd);
 		len = strlen(path);
 
 		if (len > repolen && strncmp(path, repo_abspath, repolen) == 0)
 			is_repo_child = 1;
-		if (len > cwdlen && strncmp(path, cwd, cwdlen) == 0)
-			is_cwd_child = 1;
 
 		if (strcmp(path, repo_abspath) == 0) {
 			free(path);
@@ -720,15 +713,6 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 				err = got_error_from_errno("strdup");
 				goto done;
 			}
-		} else if (is_repo_child && is_cwd_child) {
-			char *child;
-			/* Strip common prefix with repository path. */
-			err = got_path_skip_common_ancestor(&child,
-			    repo_abspath, path);
-			if (err)
-				goto done;
-			free(path);
-			path = child;
 		} else if (is_repo_child) {
 			/* Matched an on-disk path inside repository. */
 			if (got_repo_is_bare(repo)) {
@@ -746,15 +730,6 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 				free(path);
 				path = child;
 			}
-		} else if (is_cwd_child) {
-			char *child;
-			/* Strip common prefix with cwd. */
-			err = got_path_skip_common_ancestor(&child, cwd,
-			    path);
-			if (err)
-				goto done;
-			free(path);
-			path = child;
 		} else {
 			/*
 			 * Matched unrelated on-disk path.
@@ -775,7 +750,6 @@ got_repo_map_path(char **in_repo_path, struct got_repo
 	}
 
 done:
-	free(cwd);
 	free(canonpath);
 	if (err)
 		free(path);