Commit Diff


commit - 8994de28866d144bef48299e4b6ae87a8927f4bc
commit + d1542a279fa71d03ea53283d994b76f9b48824af
blob - f4d98f7208b7cbd0bf5d9a9ea8b0af5fe29a606c
blob + 6a1ed9214ccefdc0e2e7887070242ef8d0cde738
--- lib/worktree.c
+++ lib/worktree.c
@@ -403,7 +403,9 @@ got_worktree_open(struct got_worktree **worktree, cons
 		if (*worktree)
 			return NULL;
 		path = dirname(path);
-	} while (path && !(path[0] == '.' && path[1] == '\0'));
+		if (path == NULL)
+			return got_error_from_errno();
+	} while (!((path[0] == '.' || path[0] == '/') && path[1] == '\0'));
 
 	return got_error(GOT_ERR_NOT_WORKTREE);
 }