Merge branch 'lt/commit-tree-guess-utf-8'
[gitweb.git] / builtin / prune.c
index 58d7cb83240ecef7ab3ff82f3aa92959ec7a62fe..6cb99443c1a1773b6a8207dfbcc6d1e053e70ce4 100644 (file)
@@ -25,7 +25,8 @@ static int prune_tmp_object(const char *path, const char *filename)
                return error("Could not stat '%s'", fullpath);
        if (st.st_mtime > expire)
                return 0;
-       printf("Removing stale temporary file %s\n", fullpath);
+       if (show_only || verbose)
+               printf("Removing stale temporary file %s\n", fullpath);
        if (!show_only)
                unlink_or_warn(fullpath);
        return 0;
@@ -85,9 +86,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;
 }