Commit 26c4ac4df0a7fa02e8cb703d2f0e6b9da84d0f82

Stefan Sperling 2019-01-08T20:40:28

stop trying to remove parents if a non-empty parent is traversed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/lib/worktree.c b/lib/worktree.c
index a728112..9bba742 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -819,8 +819,9 @@ remove_missing_file(const char *path, void *data, void *arg)
 	else {
 		char *parent = dirname(ondisk_path);
 		while (parent && strcmp(parent, a->root_path) != 0) {
-			if (rmdir(parent) == -1 && errno != ENOTEMPTY) {
-				err = got_error_from_errno();
+			if (rmdir(parent) == -1) {
+				if (errno != ENOTEMPTY)
+					err = got_error_from_errno();
 				break;
 			}
 			parent = dirname(parent);