Skip to content

repo: add paths.toplevel to repo info#2264

Open
jayesh0104 wants to merge 1 commit intogit:masterfrom
jayesh0104:repo-toplevel
Open

repo: add paths.toplevel to repo info#2264
jayesh0104 wants to merge 1 commit intogit:masterfrom
jayesh0104:repo-toplevel

Conversation

@jayesh0104
Copy link
Copy Markdown
Contributor

repo info currently does not expose the repository's
working tree root, even though this information is
available via repo_get_work_tree().

This makes it harder for scripts to retrieve the
repository root through a structured interface, often
requiring the use of git rev-parse --show-toplevel.

Add a new field paths.toplevel to git repo info
that returns the working tree root. For bare repositories,
this value is empty, consistent with other non-applicable
fields.

This provides a consistent and script-friendly way to
query repository paths without invoking additional
commands.

cc: Derrick Stolee stolee@gmail.com
Signed-off-by: Jayesh Daga jayeshdaga99@gmail.com

@gitgitgadget-git
Copy link
Copy Markdown

There is a merge commit in this Pull Request:

4cd84b90340c4ceb6e76147dc5c01baa2c00b53a

Please rebase the branch and force-push.

@gitgitgadget-git
Copy link
Copy Markdown

There is a merge commit in this Pull Request:

4eb5686db9ac7e0771f57e0fdb03581606b9ab1a

Please rebase the branch and force-push.

1 similar comment
@gitgitgadget-git
Copy link
Copy Markdown

There is a merge commit in this Pull Request:

4eb5686db9ac7e0771f57e0fdb03581606b9ab1a

Please rebase the branch and force-push.

@jayesh0104 jayesh0104 force-pushed the repo-toplevel branch 2 times, most recently from 47e9cf4 to 448dfae Compare April 2, 2026 16:25
@jayesh0104
Copy link
Copy Markdown
Contributor Author

/submit

@gitgitgadget-git
Copy link
Copy Markdown

Submitted as pull.2264.git.git.1775150062407.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2264/jayesh0104/repo-toplevel-v1

To fetch this version to local tag pr-git-2264/jayesh0104/repo-toplevel-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2264/jayesh0104/repo-toplevel-v1

@jayesh0104
Copy link
Copy Markdown
Contributor Author

/submit

@gitgitgadget-git
Copy link
Copy Markdown

Submitted as pull.2264.v2.git.git.1775668134796.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-2264/jayesh0104/repo-toplevel-v2

To fetch this version to local tag pr-git-2264/jayesh0104/repo-toplevel-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-2264/jayesh0104/repo-toplevel-v2

repo info currently does not expose the repository's
working tree root, even though this information is
available via `repo_get_work_tree()` and
`git rev-parse --show-toplevel`.

Add a new field `paths.toplevel` to expose this value.

While doing so, document the correspondence between
`git rev-parse` options and `repo info` fields to make
it easier to identify missing or future additions.

For bare repositories, this value is empty, consistent
with other non-applicable fields.

Signed-off-by: Jayesh Daga jayeshdaga99@gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant