Commit Diff


commit - ef2a1e11cfd5e1e90e183fca027e98221720ba7e
commit + 69960a46af3e7b725e6698e08dc508d7baf38831
blob - 3354651f74d6dc8bb3f01e94c89a7234bb71a85d
blob + d78d99711a0f9e56a4e5fe825df4277494687c05
--- lib/worktree.c
+++ lib/worktree.c
@@ -2239,9 +2239,15 @@ collect_commitables(void *arg, unsigned char status, c
 	    status != GOT_STATUS_DELETE)
 		return NULL;
 
-	err = got_path_dirname(&parent_path, path);
-	if (err)
-		return err;
+	if (strchr(path, '/') == NULL) {
+		parent_path = strdup("/");
+		if (parent_path == NULL)
+			return got_error_from_errno();
+	} else {
+		err = got_path_dirname(&parent_path, path);
+		if (err)
+			return err;
+	}
 
 	ct = malloc(sizeof(*ct));
 	if (ct == NULL) {