From: Phillip Wood <phillip.wood123@gmail•com>
To: K Jayatheerth <jayatheerthkulkarni2005@gmail•com>, git@vger•kernel.org
Cc: jltobler@gmail•com, lucasseikioshiro@gmail•com,
gitster@pobox•com, phillip.wood@dunelm•org.uk,
sandals@crustytoothpaste•net, kumarayushjha123@gmail•com,
a3205153416@gmail•com
Subject: Re: [GSoC][PATCH 1/4] path: add strbuf_add_path for formatting paths
Date: Tue, 2 Jun 2026 14:00:37 +0100 [thread overview]
Message-ID: <73c1f6ee-9461-4cf3-8d51-33de05f6d070@gmail.com> (raw)
In-Reply-To: <20260601151950.30686-2-jayatheerthkulkarni2005@gmail.com>
On 01/06/2026 16:19, K Jayatheerth wrote:
>
> diff --git a/path.h b/path.h
> index 0434ba5e07..b9b626ce4a 100644
> --- a/path.h
> +++ b/path.h
> @@ -262,6 +262,22 @@ enum scld_error safe_create_leading_directories_no_share(char *path);
> int safe_create_file_with_leading_directories(struct repository *repo,
> const char *path);
>
> +enum path_format_type {
> + PATH_FORMAT_DEFAULT,
> + PATH_FORMAT_RELATIVE,
> + PATH_FORMAT_CANONICAL
> +};
> +
> +enum path_default_type {
> + PATH_DEFAULT_RELATIVE,
> + PATH_DEFAULT_RELATIVE_IF_SHARED,
> + PATH_DEFAULT_CANONICAL,
> + PATH_DEFAULT_UNMODIFIED
> +};
> +
> +void strbuf_add_path(struct strbuf *buf, const char *path, const char *prefix,
> + enum path_format_type format, enum path_default_type def);
This API is very specific to rev-parse and to me at least it is hard to
understand. I think it would be clearer if we had a single enum
describing the desired format and let the rev-parse code worry about
passing the appropriate value based on the options the user passed.
enum path_format {
PATH_FORMAT_ABSOLUTE,
PATH_FORMAT_CANONICAL,
PATH_FORMAT_RELATIVE,
PATH_FORMAT_RELATIVE_IF_SHARED PATH_FORMAT_UNMODIFIED,
};
void format_path(struct strbuf *buf, const char *path,
const char *prefix, enum path_format format);
We tend to avoid adding "strbuf_" to the beginning of functions these
days when they're adding things to a strbuf. This function also needs
some documentation explaining what the arguments are.
Thanks
Phillip
next prev parent reply other threads:[~2026-06-02 13:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 15:19 [GSoC][PATCH 0/4] teach git repo info to handle path keys K Jayatheerth
2026-06-01 15:19 ` [GSoC][PATCH 1/4] path: add strbuf_add_path for formatting paths K Jayatheerth
2026-06-02 13:00 ` Phillip Wood [this message]
2026-06-01 15:19 ` [GSoC][PATCH 2/4] rev-parse: use strbuf_add_path for path formatting K Jayatheerth
2026-06-01 15:19 ` [GSoC][PATCH 3/4] repo: add path.gitdir with absolute and relative suffix formatting K Jayatheerth
2026-06-01 16:28 ` Lucas Seiki Oshiro
2026-06-01 23:09 ` Junio C Hamano
2026-06-01 15:19 ` [GSoC][PATCH 4/4] repo: add path.commondir " K Jayatheerth
2026-06-01 16:34 ` Lucas Seiki Oshiro
2026-06-01 21:58 ` Lucas Seiki Oshiro
2026-06-01 16:25 ` [GSoC][PATCH 0/4] teach git repo info to handle path keys Lucas Seiki Oshiro
2026-06-01 22:04 ` Lucas Seiki Oshiro
2026-06-01 23:05 ` Junio C Hamano
2026-06-02 13:03 ` Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=73c1f6ee-9461-4cf3-8d51-33de05f6d070@gmail.com \
--to=phillip.wood123@gmail$(echo .)com \
--cc=a3205153416@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=jayatheerthkulkarni2005@gmail$(echo .)com \
--cc=jltobler@gmail$(echo .)com \
--cc=kumarayushjha123@gmail$(echo .)com \
--cc=lucasseikioshiro@gmail$(echo .)com \
--cc=phillip.wood@dunelm$(echo .)org.uk \
--cc=sandals@crustytoothpaste$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox