Skip to content

Commit 90b29cb

Browse files
drafnelgitster
authored andcommitted
prune.c: only print informational message in show_only or verbose mode
"git prune" reports removal of loose object files that are no longer necessary only under the "-v" option, but unconditionally reports removal of temporary files that are no longer needed. The original thinking was that the presence of a leftover temporary file should be an unusual occurrence that may indicate an earlier failure of some sort, and the user may want to be reminded of it. Removing an unnecessary loose object file, on the other hand, is just part of the normal operation. That is why the former is always printed out and the latter only when -v is used. But neither report is particularly useful. Hide both of these behind the "-v" option for consistency. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e15c16d commit 90b29cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builtin/prune.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ static int prune_tmp_object(const char *path, const char *filename)
2525
return error("Could not stat '%s'", fullpath);
2626
if (st.st_mtime > expire)
2727
return 0;
28-
printf("Removing stale temporary file %s\n", fullpath);
28+
if (show_only || verbose)
29+
printf("Removing stale temporary file %s\n", fullpath);
2930
if (!show_only)
3031
unlink_or_warn(fullpath);
3132
return 0;

0 commit comments

Comments
 (0)