Re: [GSoC Patch v2 5/7] repo: add path.index with absolute and relative suffix formatting

Junio C Hamano <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
K Jayatheerth <[email protected]> writes:

> While bare repos don't have a working tree (and therefore usually no index),
> scripts do sometimes set GIT_INDEX_FILE to build temporary indexes for
> tree manipulation.
>
> Should we strictly return an empty string for bare repos (similar to
> how we handle path.toplevel),
> or should we return the default <gitdir>/index path in case a script
> wants to know where it would be?

The path to the top level can be an empty string if you are already
at the top level, which is neither an error nor an unusual
condition.  I do not understand the contrast you are drawing here.

I expect "tell me where the index is" to return <gitdir>/index,
$GIT_INDEX_FILE, or whatever Git sets during setup.  In other words,
whatever repo's '.index_file' member holds when control reaches
repo_read_index().

If a script checks that location and finds no file, that is the
natural way to learn there is no index.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.