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

Re: [PATCH 4/4] repo: add the field path.toplevel

From
Lucas Seiki Oshiro <lucasseikioshiro@gmail.com>
Date
Mar 1, 2026, 20:21 UTC
Message-ID
<9789E676-4DE0-4C4C-BCAC-5BD880A51CE1@gmail.com>
In-Reply-To
<71e42a01-6077-48fc-876e-555431d1288f@gmail.com>
> Hi Lucas,
Hi, Tian!
Show 6 quoted lines
> > +void strbuf_add_path(struct strbuf *sb, const char *path, const char > *prefix, enum path_format_type format, enum path_default_type def)
> 
> Isn't it a bit inappropriate for a generic character concatenation
> function to know about format and def? I don't think this should be
> the responsibility of a low-level function, at least not
> str_buf_add_path().

I don't think it can be considered a low-level function, but I agree that its name can be misleading.

> > + prefix = cwd = xgetcwd()
> 
> Will there be a performance regression? Since xgetcwd() here is a
> system call, right?
In this case, no, it is defined in wrapper.h.
Show 7 quoted lines
> I don't think we should add the two new parameters to all get_
> functions here. As changed in your patch, functions like
> get_object_format don't really, need to know about prefix or format,
> so the corresponding parameters are marked as UNUSED. Imagine if
> more and more data needs to be retrieved by these get_ series
> functions in the future — is it really advisable to add unnecessary
> parameters to all remaining functions just for the sake of a few?

In this case, we need to add them to match the signature of get_value_fn. Those values will be useful for all the path.*, but if we start to add more than that I agree that we'll need to think in a better solution.

> I'm not entirely sure about the above content either; I'm just
> throwing out ideas to spark discussion. (´~`)

Thanks, it's also good to see more points of view. I'm also not sure about it :-)

Previous: Tian YuchenNext: Tian Yuchen
Message 7 of 26 in “repo: add support for path-related fields”
  1. 0/4 repo: add support for path-related fieldsLucas Seiki Oshiro, Feb 28, 2026
  2. 1/4 rev-parse: prepend `path_` to path-related enumsLucas Seiki Oshiro, Feb 28, 2026
  3. 2/4 path: add new function strbuf_add_pathLucas Seiki Oshiro, Feb 28, 2026
  4. 3/4 repo: add the --format-path flagLucas Seiki Oshiro, Feb 28, 2026
  5. 4/4 repo: add the field path.toplevelLucas Seiki Oshiro, Feb 28, 2026
  6. Tian YuchenMar 1, 2026
  7. Lucas Seiki OshiroMar 1, 2026
  8. Tian YuchenMar 2, 2026
  9. JAYATHEERTH KMar 1, 2026
  10. Ayush JhaMar 1, 2026
  11. JAYATHEERTH KMar 1, 2026
  12. Lucas Seiki OshiroMar 1, 2026
  13. Ayush JhaMar 3, 2026
  14. Lucas Seiki OshiroMar 1, 2026
  15. Phillip WoodMar 1, 2026
  16. Lucas Seiki OshiroMar 1, 2026
  17. brian m. carlsonMar 1, 2026
  18. Junio C HamanoMar 2, 2026
  19. Tian YuchenMar 2, 2026
  20. Junio C HamanoMar 2, 2026
  21. JAYATHEERTH KMar 3, 2026
  22. Tian YuchenMar 3, 2026
  23. JAYATHEERTH KMar 3, 2026
  24. Tian YuchenMar 3, 2026
  25. JAYATHEERTH KMar 3, 2026
  26. Lucas Seiki OshiroMar 8, 2026

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.