From: K Jayatheerth Date: Mon, 09 Nov 2026 16:52:33 GMT Subject: Re: [GSoC Patch v8 0/7] repo: add path keys to repo info Message-ID: In-Reply-To: <9582c0da-7aff-466c-a510-ce5a10054df4@gmail.com> Hey Phillip, On Sun, Nov 8, 2026 at 1:27 AM Phillip Wood wrote: > > On 07/11/2026 16:00, K Jayatheerth wrote: > > I'm a bit late to the party, I like the idea of adding some more paths > to "git repo", but I have a few comments about the design of this series. > > > This patch series continues the work to expose repository paths and > > metadata via the `git repo info` command. It introduces several keys for > > querying repository paths in standard absolute and relative formats, as well > > as refactoring `get_superproject_working_tree()` to operate on a `struct > > repository *`. > > > > The path keys added in this series are: > > - `path.toplevel.absolute` / `path.toplevel.relative`: The root directory > > of the working tree (or an empty string in bare repositories). > > In our documentation and glossary, we call this directory the "working > tree" so I think "path.working-tree.*" would be a better name, rather > than copying the name from the equivalent rev-parse option. > > > - `path.superproject-root.absolute` / `path.superproject-root.relative`: > > The root of the superproject when inside a submodule. > > Personally, I'd prefer "path.superproject-working-tree.*" here, though I > see Justin thought that was a bit of a mouthful. As this command is for > use in scripts I'd rather have a descriptive name. > I don't have an opinion on the name itself, but, that said: I think superproject-working-tree is a more suiting name. It is becuase you may have a working tree in a different place and it might not be the root itself. I think the same logic applies for toplevel too. Any more thoughts from Justin, Lucas, Junio or any other reviewer would be better I reckon. > > - `path.hooks.absolute` / `path.hooks.relative`: The repository's hooks > > directory (respecting `core.hooksPath`, including `/dev/null`). > > Given we have config based hooks now, do we really want to add this? > Scripts that want to run hooks should be using "git hook run" and > scripts that want to install hooks should be using the config based > hooks so that they co-exist with the user's existing hooks. > I believe that is a fair point for new tooling, though wouldn't many existing scripts and third-party tools still learn about hooks directly via `git rev-parse --git-path hooks`? Since the main goal of `git repo info` is to provide an alternative to `rev-parse`'s various path flags, `path.hooks` still seems useful for scripts migrating over, unless the consensus is to deprecate querying the hooks directory altogether. > > - `path.index.absolute` / `path.index.relative`: The repository's active > > index file. > > - `path.git-prefix`: The prefix from the worktree root to the current > > working directory. > > The "git-" prefix seems a bit odd to me, maybe "path.prefix" would be a > better name for an option that returns the prefix to add to paths? > Agreed, I would change this in the next patch series. > > - `path.cdup`: The relative path from the current directory up to the > > worktree root. > > How does this differ from path.working-tree.relative? I've never really > understood "git rev-parse --cdup" - if you're in the repository root > directory, 'cd "$(git rev-parse --cdup)"' dumps you in your home > directory which has always seemed a bit surprising to me. > Well looking at the code itself What I can say is I find couple of edge cases, The cdup command relies on a slash counting loop on the prefix string to output directory-up sequences like '../', returns an empty string at the root and falls back to the worktree path when outside. On the contrary, relative formatting uses Git's path utility library to compute true relative filesystem paths, outputting '.' at the root instead of leaving it blank. > One note on the tests - our test suite is quite slow, so it would be > good to avoid initializing new repositories for each test where we are > checking these paths. > Alright, I will look into them and see how I can optimize them. > Thanks > > Phillip > [snip] Thank you, - K Jayatheerth