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

Re: [PATCH] remote.c: Fix overtight refspec validation

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Mar 22, 2008, 20:45 UTC
Message-ID
<alpine.LNX.1.00.0803221559220.19665@iabervon.org>
In-Reply-To
<7viqzeilp0.fsf@gitster.siamese.dyndns.org>
On Sat, 22 Mar 2008, Junio C Hamano wrote:
Show 28 quoted lines
> Daniel Barkalow <barkalow@iabervon.org> writes:
> 
> > On Fri, 21 Mar 2008, Junio C Hamano wrote:
> > ...
> >> Do you mean you want the callers of this internal implementation to also
> >> loop over the input set of refs?  I think that would be more complex code
> >> but I do not see much gain by doing so.
> >
> > I think it's more breadth but less depth. It would make the internal 
> > implementation not depend on fetch, and put the checks that only apply to 
> > fetch out of the push code path and vice versa.
> >
> > Or just have a section
> >
> > 	if (fetch) {
> > 		// checks for fetch LHS
> > 		// checks for fetch RHS
> > 	} else {
> > 		// checks for push LHS
> > 		// checks for push RHS
> > 	}
> >
> > The body of the condition is only four lines, after all.
> 
> There are two commits on jc/refspec-fix branch merged to 'pu'.  The
> earlier one is my version, and the one on top is based on the above
> suggestion.  I do not know which one is clearer, more readable and
> maintainable.

I like the second one quite a bit. If nothing else, it's got, as the comments, the best documentation of refspecs I've seen, and then it's got code which clearly implements those rules. I think the explicitness is worth the extra lines.

Thanks for taking care of this; as a result of starting a new job, I haven't had much in the way of coding attention for other stuff the past couple of weeks.

	-Daniel
*This .sig left intentionally blank*
Previous: Junio C HamanoNext: Linus Torvalds
Message 14 of 20 in “Permit refspec source side to parse as a sha1”
  1. Permit refspec source side to parse as a sha1Daniel Barkalow, Mar 21, 2008
  2. Junio C HamanoMar 21, 2008
  3. Junio C HamanoMar 21, 2008
  4. Daniel BarkalowMar 21, 2008
  5. Junio C HamanoMar 21, 2008
  6. Daniel BarkalowMar 21, 2008
  7. Junio C HamanoMar 21, 2008
  8. Daniel BarkalowMar 21, 2008
  9. remote.c: Fix overtight refspec validationJunio C Hamano, Mar 21, 2008
  10. Daniel BarkalowMar 21, 2008
  11. Junio C HamanoMar 21, 2008
  12. Daniel BarkalowMar 22, 2008
  13. Junio C HamanoMar 22, 2008
  14. Daniel BarkalowMar 22, 2008
  15. Linus TorvaldsMar 26, 2008
  16. Junio C HamanoMar 26, 2008
  17. Junio C HamanoMar 26, 2008
  18. Daniel BarkalowMar 26, 2008
  19. Junio C HamanoMar 26, 2008
  20. Jeff KingMar 26, 2008

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.