commit - 276b94a1f9ff915aab767e558957527ccddf43e9
commit + bfd61697d22df765ef7a98856bc68c4b19109c6e
blob - 200352838ae37181b0bce33796fd9bfa11c66d34
blob + 071cab54671cf2507a4fa42a0469c6c1ced7df49
--- tog/tog.c
+++ tog/tog.c
if (worktree) {
const char *prefix = got_worktree_get_path_prefix(worktree);
- char *wt_path, *p;
+ char *p;
- err = got_worktree_resolve_path(&wt_path, worktree, argv[0]);
+ err = got_worktree_resolve_path(&p, worktree, argv[0]);
if (err)
return err;
-
- if (asprintf(&p, "%s%s%s", prefix,
- (strcmp(prefix, "/") != 0) ? "/" : "", wt_path) == -1) {
+ if (asprintf(in_repo_path, "%s%s%s", prefix,
+ (p[0] != '\0' && !got_path_is_root_dir(prefix)) ? "/" : "",
+ p) == -1) {
err = got_error_from_errno("asprintf");
- free(wt_path);
- return err;
+ *in_repo_path = NULL;
}
- err = got_repo_map_path(in_repo_path, repo, p, 0);
free(p);
- free(wt_path);
} else
err = got_repo_map_path(in_repo_path, repo, argv[0], 1);