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 <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		
				
					committed by
					
						
						Junio C Hamano
					
				
			
			
				
	
			
			
			
						parent
						
							e15c16de39
						
					
				
				
					commit
					90b29cb7a8
				
			@ -25,6 +25,7 @@ static int prune_tmp_object(const char *path, const char *filename)
 | 
				
			|||||||
		return error("Could not stat '%s'", fullpath);
 | 
							return error("Could not stat '%s'", fullpath);
 | 
				
			||||||
	if (st.st_mtime > expire)
 | 
						if (st.st_mtime > expire)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
						if (show_only || verbose)
 | 
				
			||||||
		printf("Removing stale temporary file %s\n", fullpath);
 | 
							printf("Removing stale temporary file %s\n", fullpath);
 | 
				
			||||||
	if (!show_only)
 | 
						if (!show_only)
 | 
				
			||||||
		unlink_or_warn(fullpath);
 | 
							unlink_or_warn(fullpath);
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user