commit - 5f9fef37548c12ab4d87590e1d6d2cb0929e58e6
commit + c97665ae45fef5919c0cfb789fafc56449be3409
blob - 71f2090284801acae74a36d8b9fd3e297c521bb9
blob + 43321ad6065fe5af9c29235580ecc1b15138c1bc
--- lib/worktree.c
+++ lib/worktree.c
if (asprintf(&ondisk_path, "%s/%s", root_path, path) == -1)
return got_error_from_errno();
- if (unlink(ondisk_path) == -1)
- err = got_error_from_errno();
- else {
+ if (unlink(ondisk_path) == -1) {
+ if (errno != ENOENT)
+ err = got_error_from_errno();
+ } else {
char *parent = dirname(ondisk_path);
while (parent && strcmp(parent, root_path) != 0) {
if (rmdir(parent) == -1) {