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

Re: [RFC/PATCH 0/5] remote: eliminate remote->{fetch,push}_refspec and lazy parsing of refspecs

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 19, 2017, 20:07 UTC
Message-ID
<xmqqmv93spvb.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170617115522.lbke5wnle5irbunj@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 13 quoted lines
> If we forget the "storing it twice" argument, would it make sense to
> convert the parallel arrays of items into a single array-of-struct?
> I.e.:
>
>   struct configured_refspec {
> 	const char *string;
> 	struct refspec refspec;
> 	unsigned parsed:1;
>   }
>
> I guess that may run into problems where we really need an
> array-of-refspec to pass into sub-functions. So going further, could we
> just have "struct refspec" store the text form it was parsed from?
I find this a sensible suggestion.  

I think the original "parallel" structure was anticipating that a textual input we get from the user (either from the command line or from the configuration) could expand to multiple parsed refspecs for easier use by the code, but it appears that we hadn't seen a need for that, so I think it is safe to unify them into a single struct.

Of course, that still anticipates that a parsed refspec may not be unambiguously turned back to textual original input form; if that will never be the case, then the approach taken by the posted patches should also be OK.

Previous: Jeff King
Message 12 of 12 in “remote: eliminate remote->{fetch,push}_refspec and lazy parsing of refspecs”
  1. 0/5 remote: eliminate remote->{fetch,push}_refspec and lazy parsing of refspecsSZEDER Gábor, Jun 16, 2017
  2. 2/5 remote.c: don't pass copies of refspecs to add_{fetch,push}_refspec()SZEDER Gábor, Jun 16, 2017
  3. 4/5 remote.c: eliminate remote->fetch_refspecSZEDER Gábor, Jun 16, 2017
  4. 1/5 remote: don't use remote->{fetch,push}_refspecSZEDER Gábor, Jun 16, 2017
  5. Junio C HamanoJun 16, 2017
  6. 3/5 remote.c: extract a helper function to parse a single refspecSZEDER Gábor, Jun 16, 2017
  7. 5/5 remote.c: eliminate remote->push_refspecSZEDER Gábor, Jun 16, 2017
  8. Junio C HamanoJun 16, 2017
  9. SZEDER GáborJun 17, 2017
  10. Jeff KingJun 17, 2017
  11. Jeff KingJun 17, 2017
  12. Junio C HamanoJun 19, 2017

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.