Commit f7b389259216725a5f122fbf01a6bbd685b96642

Stefan Sperling 2018-04-01T20:40:35

make paths shown during checkout match what is created on disk

diff --git a/got/got.c b/got/got.c
index fffacf8..660a5a1 100644
--- a/got/got.c
+++ b/got/got.c
@@ -206,7 +206,7 @@ cmd_checkout(int argc, char *argv[])
 		free(cwd);
 	} else if (argc == 2) {
 		repo_path = argv[0];
-		worktree_path = strdup(argv[1]);
+		worktree_path = realpath(argv[1], NULL);
 		if (worktree_path == NULL)
 			return got_error_from_errno();
 	} else
diff --git a/lib/worktree.c b/lib/worktree.c
index 80b9f97..a7d4b7d 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -482,6 +482,7 @@ tree_checkout_entry(struct got_worktree *worktree,
 	struct got_blob_object *blob = NULL;
 	struct got_tree_object *tree = NULL;
 	char *path = NULL;
+	char *progress_path = NULL;
 	size_t len;
 
 	if (parent[0] == '/' && parent[1] == '\0')
@@ -500,7 +501,10 @@ tree_checkout_entry(struct got_worktree *worktree,
 	if (err)
 		goto done;
 
-	(*progress_cb)(progress_arg, path);
+	progress_path = path;
+	if (strncmp(progress_path, worktree->path_prefix, len) == 0)
+		progress_path += len;
+	(*progress_cb)(progress_arg, progress_path);
 
 	switch (got_object_get_type(obj)) {
 	case GOT_OBJ_TYPE_BLOB: