apply: refactor "previous patch" logic
[gitweb.git] / builtin / prune.c
index 58d7cb83240ecef7ab3ff82f3aa92959ec7a62fe..b99b635e44f6145395b5c761505099c0a0f5b6cc 100644 (file)
@@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
                }
                fprintf(stderr, "bad sha1 file: %s/%s\n", path, de->d_name);
        }
+       closedir(dir);
        if (!show_only)
                rmdir(path);
-       closedir(dir);
        return 0;
 }