Re: [GSoC Patch v5 7/7] repo: add path.cdup
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 25, 2026, 19:31 UTC
- Message-ID
- <xmqq7blem1y6.fsf@gitster.g>
- In-Reply-To
- <20260825175818.645579-8-jayatheerthkulkarni2005@gmail.com>
K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:
Show 13 quoted lines
> +static int get_path_cdup(struct repository *repo, struct strbuf *buf)
> +{
> + const char *pfx = repo->prefix;
> +
> + while (pfx) {
> + pfx = strchr(pfx, '/');
> + if (pfx) {
> + pfx++;
> + strbuf_addstr(buf, "../");
> + }
> + }
> + return 0;
> +}Can we have a small common helper library (e.g., repo-info.c at the top level) shared between this code and builtin/rev-parse.c so that we have only a single implementation of 'cdup'?
The same comment applies to all the other features that duplicate implementations from rev-parse and elsewhere in the repo-info file.