Commit Diff


commit - 517bab732f80f5ecc6af2ffcfe6fe1e363303c01
commit + 0647c5632b63a9e72b2b15674297b10429322f97
blob - c80536c52f3c5670a3652891139127860e64c8f7
blob + 5aff68d747e08015367d0201cf56f3ebc9d840be
--- lib/worktree.c
+++ lib/worktree.c
@@ -374,7 +374,7 @@ open_worktree(struct got_worktree **worktree, const ch
 	}
 	(*worktree)->lockfd = -1;
 
-	(*worktree)->root_path = realpath(path, NULL);
+	(*worktree)->root_path = strdup(path);
 	if ((*worktree)->root_path == NULL) {
 		err = got_error_from_errno();
 		goto done;
@@ -1180,8 +1180,7 @@ const struct got_error *
 got_worktree_get_base_ref_name(char **refname, struct got_worktree *worktree)
 {
 	const struct got_error *err = NULL;
-	const char *root_path;
-	char *uuidstr = NULL, *s;
+	char *uuidstr = NULL;
 	uint32_t uuid_status;
 
 	*refname = NULL;
@@ -1190,23 +1189,11 @@ got_worktree_get_base_ref_name(char **refname, struct 
 	if (uuid_status != uuid_s_ok)
 		return got_error_uuid(uuid_status);
 
-	root_path = got_worktree_get_root_path(worktree);
-	while (root_path[0] == '/')
-		root_path++;
-	if (asprintf(refname, "%s-%s-%s", GOT_WORKTREE_BASE_REF_PREFIX,
-	    root_path, uuidstr) == -1) {
+	if (asprintf(refname, "%s-%s", GOT_WORKTREE_BASE_REF_PREFIX, uuidstr)
+	    == -1) {
 		err = got_error_from_errno();
-		goto done;
-	}
-
-	/* Replace slashes from worktree's on-disk path with dashes. */
-	s = *refname + sizeof(GOT_WORKTREE_BASE_REF_PREFIX) - 1;
-	while (*s) {
-		if (*s == '/')
-			*s = '-';
-		s++;
+		*refname = NULL;
 	}
-done:
 	free(uuidstr);
 	return err;
 }