From: K Jayatheerth Date: Wed, 23 Sep 2026 17:25:54 GMT Subject: Re: [GSoC Patch v6 4/7] repo: add path.index with absolute and relative suffixes Message-ID: In-Reply-To: > > + 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. > I think I am just gonna remove the if condition from get_path_index_relative() and let repo_get_index_file handle the bug instead of rewriting the logic. > > +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. Same for this.