git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Petr Baudis <pasky@suse.cz>
Date
Oct 27, 2006, 01:45 UTC
Message-ID
<20061027014501.GU20017@pasky.or.cz>
In-Reply-To
<4540F16F.4060604@shadowen.org>
Junio wrote:
> - We do not enclose a single statement in {}.

I don't think we need to enforce this rule in particular too rigorously since in comparison with other style slips, it doesn't put you off by unusual styling when you are reading the code, its only effect at all is slight vertical space waste (but it isn't a pure loss anyway, for that matter).

Dear diary, on Thu, Oct 26, 2006 at 07:33:35PM CEST, I got a letter where Andy Whitcroft <apw@shadowen.org> said that...

Show 37 quoted lines
> 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 <andyparkins@gmail.com>
> > ---
> >  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>

Seconded and please use just 'unknown' for the type string, so that you can split the lines on spaces in scripts.

Besides, in what situation do we actually get the unknown output?
Thanks,
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
Previous: Andy WhitcroftNext: Andy Parkins
Message 8 of 10 in “Improve git-prune -n output”
  1. Improve git-prune -n outputAndy Parkins, Oct 26, 2006
  2. Junio C HamanoOct 26, 2006
  3. Andy ParkinsOct 26, 2006
  4. Improve git-prune -n outputAndy Parkins, Oct 27, 2006
  5. Jakub NarebskiOct 28, 2006
  6. Junio C HamanoOct 28, 2006
  7. Andy WhitcroftOct 26, 2006
  8. Petr BaudisOct 27, 2006
  9. Andy ParkinsOct 27, 2006
  10. Junio C HamanoOct 27, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.