Subject: Re: [PATCH] Improve git-prune -n output

From: Andy Whitcroft <[email-masked]>
Date: Thu, 26 Oct 2006 18:33:35 +0100

Andy Parkins wrote:
> prune_object() in show_only mode would previously just show the path to the
> object that would be deleted.  The path the object is stored in shouldn't be
> shown to users, they only know about sha1 identifiers so show that instead.
> 
> Further, the sha1 alone isn't that useful for examining what is going to be
> deleted.  This patch also adds the object type to the output, which makes it
> easy to pick out, say, the commits and use git-show to display them.
> Signed-off-by: Andy Parkins <[email-masked]>
> ---
>  builtin-prune.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/builtin-prune.c b/builtin-prune.c
> index 7290e6d..e3bcf5f 100644
> --- a/builtin-prune.c
> +++ b/builtin-prune.c
> @@ -16,8 +16,13 @@ static struct rev_info revs;
>  
>  static int prune_object(char *path, const char *filename, const unsigned char *sha1)
>  {
> +	char type[20];
> +
>  	if (show_only) {
> -		printf("would prune %s/%s\n", path, filename);
> +		if (sha1_object_info(sha1, type, NULL)) {
> +			strcpy( type, "unknown type" );
> +		}
> +		printf("would prune %s %s\n", sha1_to_hex( sha1 ), type );
>  		return 0;
>  	}
>  	unlink(mkpath("%s/%s", path, filename));

If we are changing the format would it not make more sense to be in the
same order as the tool that lets you use it?

I thought that was git cat-file <type> <commit-ish>