Re: [GSoC Patch v6 4/7] repo: add path.index with absolute and relative suffixes
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 11, 2026, 16:55 UTC
- Message-ID
- <xmqqse3fbudk.fsf@gitster.g>
- In-Reply-To
- <20260911144519.1011780-5-jayatheerthkulkarni2005@gmail.com>
K Jayatheerth <jayatheerthkulkarni2005@gmail.com> writes:
Show 6 quoted lines
> +static int get_path_index_absolute(struct repository *repo, struct strbuf *buf)
> +{
> + const char *index_file = repo_get_index_file(repo);
> +
> + if (!index_file)
> + return error(_("unable to get index file"));This is a dead code, as repo_get_index_file() calls BUG("") when it finds that the repo instance is not ready to return this information.
Hence I am debating myself if this is a better alternative:
const char *index_file = repo->index_file;
if (!index_file) return error(...);
I dunno.
Show 10 quoted lines
> +static int get_path_index_relative(struct repository *repo, struct strbuf *buf)
> +{
> + const char *index_file = repo_get_index_file(repo);
> +
> + if (!index_file)
> + return error(_("unable to get index file"));
> +
> + format_path(buf, index_file, repo->prefix, PATH_FORMAT_RELATIVE);
> + return 0;
> +}Ditto.