Re: [GSoC PATCH v2 1/4] path: introduce format_path() for centralized path formatting
From: Kristoffer Haugsbakk <hidden>
Date: 2026-06-05 16:56:17
On Fri, Jun 5, 2026, at 18:30, K Jayatheerth wrote:
The path-formatting logic inside `builtin/rev-parse.c` handles absolute, canonical, and relative formatting rules based on user-supplied options. However, this logic is tightly coupled to `rev-parse` and writes directly to stdout. To allow other builtins (such as the upcoming `git repo` path keys) to re-use this logic, extract the core path-formatting algorithm into a centralized helper function, `format_path()`, in `path.c`. Expose a single, streamlined `path_format` enum in `path.h` to let callers explicitly declare their formatting strategy (UNMODIFIED, RELATIVE, RELATIVE_IF_SHARED, or CANONICAL). This decouples the core algorithm from the localized fallback mechanics specific to `rev-parse`.
This looks very well explained to my naive eyes.
Signed-off-by: K Jayatheerth <redacted> Mentored-by: Justin Tobler [off-list ref] Mentored-by: Lucas Seiki Oshiro [off-list ref]
Nitpick. You are supposed to add your `Signed-off-by` at the end. You
are saying with that line that you are signing off on the changes and
the commit message, including the trailers (mentors) you’ve decided to
add. Imagine if the maintainer applies this patch and fixes a typo and
the commit becomes:
Mentored-by: Justin Tobler [off-list ref]
Mentored-by: Lucas Seiki Oshiro [off-list ref]
Signed-off-by: K Jayatheerth [off-list ref]
[jc: typo fix]
Signed-off-by: Junio ...
The chain of custody is then very clear.
--- [snip]