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

Re: [PATCH] Use parseopts in builtin-fetch

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Nov 5, 2007, 17:14 UTC
Message-ID
<Pine.LNX.4.64.0711051155330.7357@iabervon.org>
In-Reply-To
<20071105084333.GA25574@artemis.corp>
On Mon, 5 Nov 2007, Pierre Habouzit wrote:
Show 13 quoted lines
> On Mon, Nov 05, 2007 at 03:35:34AM +0000, Daniel Barkalow wrote:
> > Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> > ---
> > I mostly did this and the next one for practice with the API. I'm 
> > impressed that "git fetch -vv" is even handled correctly without anything 
> > special. Now that I've done it, assuming I did it right, it might as well 
> > get added to the series.
> 
>   I believe the same patches (or very similar ones) are in pu but are
> not in next yet because they conflict with the builtin-fetch recent
> series.
>
>   see http://git.madism.org/?p=git.git;a=blobdiff;f=builtin-fetch.c;h=12b1c4;hp=6b1750d;hb=7407915;hpb=61610e6

Ah, okay, forgot to look there. In any case, I was mostly looking for what mistakes I shouldn't make in future conversions.

Show 11 quoted lines
> > +		OPT_BOOLEAN('q', "quiet", &quiet, "fetch silently"),
> 
>   there is an OPT__QUIET(&quiet) for this one.
> 
> > +	i = 1;
> >  	if (i < argc) {
> >  		int j = 0;
> >  		refs = xcalloc(argc - i + 1, sizeof(const char *));
> 
>   this is wrong, you meant i = 0, and frankly, it's better to just strip
> i altogether.

I didn't consume the remote name's slot, and started at the next one. But you're right that it's probably nicest to do to *argv++, argc-- thing and be zero-based for the list afterwards. I think I need the 'i' in this case, because the names get somewhat converted from the exact list given.

	-Daniel
*This .sig left intentionally blank*
Previous: Pierre HabouzitNext: Pierre Habouzit
Message 3 of 8 in “Use parseopts in builtin-fetch”
  1. Use parseopts in builtin-fetchDaniel Barkalow, Nov 5, 2007
  2. Pierre HabouzitNov 5, 2007
  3. Daniel BarkalowNov 5, 2007
  4. Pierre HabouzitNov 5, 2007
  5. Kristian HøgsbergNov 5, 2007
  6. Daniel BarkalowNov 5, 2007
  7. Junio C HamanoNov 5, 2007
  8. Pierre HabouzitNov 5, 2007

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.