commit - fb399478ba035edc9852bd7340a9f4ffee06e79a
commit + e642f803bde24b919bd4fe2ba66956b4b8173c32
blob - 21986f39664d20f4d0da79e18aaaee215efae8d0
blob + 323bf4a0ab4e5880df4f20a77702593068ee18d3
--- lib/worktree.c
+++ lib/worktree.c
if (path[0]) {
char *tree_path;
int obj_type;
- relpath = strdup(path);
- if (relpath == NULL) {
- err = got_error_from_errno("strdup");
- goto done;
- }
if (asprintf(&tree_path, "%s%s%s", worktree->path_prefix,
got_path_is_root_dir(worktree->path_prefix) ? "" : "/",
path) == -1) {
err = got_error_from_errno2("basename", path);
goto done;
}
+ } else {
+ relpath = strdup(path);
+ if (relpath == NULL) {
+ err = got_error_from_errno("strdup");
+ goto done;
+ }
}
} else {
relpath = strdup("");