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

Re: [PATCH] Make is_gitfile a non-static generic function

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 11, 2011, 23:26 UTC
Message-ID
<7vsjmzcdpf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4E94C8AB.3040807@cisco.com>
Phil Hord <hordp@cisco.com> writes:
> I'm not sure this function belongs in transport.c anymore, but
> I left it here to minimize conflicts.  I think a better home would
> be path.c, but maybe not.  If someone has a preference,
> please let me know.

I would think either transport.c or setup.c is more appropriate than path.c; the last one is more of "pathname manipulation utility bag of functions" and does not have much to do with the "Git"-ness of the path they deal with.

I am not sure if is_gitfile() is a good name for a global function, though. Also I think the interface to the function should be updated so that the caller can choose to receive the target path when the function returns with positive answer, making "read_gitfile()" unnecessary for such a caller.

As a matter of fact, couldn't we somehow unify these two slightly different implementations around the same theme, making is_gitfile() function unnecessary? As far as I can tell, the only difference between these functions is how they fail when given a non-gitfile, and many callers just call read_gitfile() without first asking if it is a gitfile.

Previous: Phil HordNext: Junio C Hamano
Message 2 of 7 in “Make is_gitfile a non-static generic function”
  1. Make is_gitfile a non-static generic functionPhil Hord, Oct 11, 2011
  2. Junio C HamanoOct 11, 2011
  3. Junio C HamanoOct 11, 2011
  4. Phil HordOct 12, 2011
  5. Phil HordOct 12, 2011
  6. Junio C HamanoOct 12, 2011
  7. Phil HordOct 12, 2011

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.