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

Re: [PATCH v4] add --summary option to git-push and git-fetch

From
Larry D'Anna <larry@elder-gods.org>
Date
Jan 30, 2010, 00:59 UTC
Message-ID
<20100130005948.GA14938@cthulhu>
In-Reply-To
<7viqhzm454.fsf@alter.siamese.dyndns.org>
I know it's been a while but.....
Show 12 quoted lines
> > @@ -373,12 +379,15 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
> >  				fputc(url[i], fp);
> >  		fputc('\n', fp);
> >  
> > -		if (ref)
> > -			rc |= update_local_ref(ref, what, note);
> > -		else
> > +		if (ref) {
> > +			*quickref = 0;
> > +			rc |= update_local_ref(ref, what, note, quickref);
> 
> Makes me wonder why update_local_ref() does not put that NUL upon entry.
I'm not sure what you mean.  Could you elaborate?
Show 12 quoted lines
> > +	init_revisions(&rev, NULL);
> > +	rev.prune = 0;
> > +	assert(!handle_revision_arg(quickref, &rev, 0, 1));
> > +	assert(!prepare_revision_walk(&rev));
> > +
> > +	while ((commit = get_revision(&rev)) != NULL) {
> > +		struct strbuf buf = STRBUF_INIT;
> > +		if (limit == 0) {
> > +			fprintf(stderr, "    ...\n");
> 
> How would you know, when you asked 20 and you showed 20 here, that there
> is no more to come?
If there's more it will print the "...", if there isn't then it won't.
Show 14 quoted lines
> > +			break;
> > +		}
> 
> > +		if (!commit->buffer) {
> > +			enum object_type type;
> > +			unsigned long size;
> > +			commit->buffer =
> > +				read_sha1_file(commit->object.sha1, &type, &size);
> > +			if (!commit->buffer)
> > +				die("Cannot read commit %s", sha1_to_hex(commit->object.sha1));
> > +		}
> > +		format_commit_message(commit, "    %m %h %s\n", &buf, 0);
> 
> Hmm, why so many spaces before %m and after %m?
So the summary lines are nicely indented with respect to the other output.
Show 6 quoted lines
> > -static int do_push(const char *repo, int flags)
> > +static int do_push(const char *repo, int flags, int summary)
> 
> Couldn't this be just another bit in the flag?  I didn't check but I
> suspect you wouldn't have to touch the intermediate functions in the call
> chain that way.

It can't just be a bit because the "summary" parameter contains number of summary lines to print.

Show 13 quoted lines
> > +test_expect_success 'fetch --summary forced update' '
> > +	mk_empty &&
> > +	(
> > ...
> > +	)
> > +
> > +'
> 
> There are at least two missing combinations. (1) "fetch --summary" to
> fetch a new branch, and (2) "fetch --summary" does not try segfaulting by
> accessing unavailable information after a failed fetch.
> 
> The same comment applies to the push side of the tests.
What would be a good way to induce a failed fetch for this test?
     --larry
Previous: Junio C HamanoNext: Junio C Hamano
Message 9 of 23 in “add --summary option to git-push and git-fetch”
  1. add --summary option to git-push and git-fetchLarry D'Anna, Jul 3, 2009
  2. Junio C HamanoJul 3, 2009
  3. add --summary option to git-push and git-fetchLarry D'Anna, Jul 7, 2009
  4. Larry D'AnnaJul 9, 2009
  5. add --summary option to git-push and git-fetchLarry D'Anna, Jul 10, 2009
  6. Stephen BoydJul 10, 2009
  7. add --summary option to git-push and git-fetchLarry D'Anna, Jul 11, 2009
  8. Junio C HamanoJul 11, 2009
  9. Larry D'AnnaJan 30, 2010
  10. Junio C HamanoJan 30, 2010
  11. Junio C HamanoJan 30, 2010
  12. Junio C HamanoJan 30, 2010
  13. add --summary option to git-push and git-fetchLarry D'Anna, Jan 30, 2010
  14. add --summary option to git-push and git-fetchLarry D'Anna, Jan 30, 2010
  15. Tay Ray ChuanJan 31, 2010
  16. Ilari LiusvaaraJan 30, 2010
  17. Junio C HamanoJan 30, 2010
  18. Ilari LiusvaaraJan 30, 2010
  19. Daniel BarkalowFeb 1, 2010
  20. Larry D'AnnaFeb 1, 2010
  21. Larry D'AnnaFeb 4, 2010
  22. Junio C HamanoFeb 4, 2010
  23. Junio C HamanoFeb 4, 2010

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.