make paths shown during checkout match what is created on disk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
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: