Thread (122 messages) 122 messages, 4 authors, 16d ago

Re: [PATCH v2 01/11] git-gui: guard set/unset of GIT_DIR and GIT_WORK_TREE

From: Mark Levedahl <hidden>
Date: 2026-05-23 16:08:20


On 5/23/26 4:18 AM, Johannes Sixt wrote:
Am 22.05.26 um 13:54 schrieb Mark Levedahl:
quoted
The manual page is incomplete: if the repository has set core.worktree=/somehere, that is
the root of the worktree and the current directory is always ignored. git rev-parse will
report /somewhere as the answer to --show-toplevel regardless of current directory, even
if inside the gitdir, and even if GIT_DIR is used.

The user can override with GIT_WORK_TREE, and if so we must keep GIT_WORK_TREE in the
environment if it was set. [...]
Oh, well, these intricacies! Let's scrap my patch and keep yours.

The other patch that removes cd $_gitworktree from do_gitk should still
be good, I think.

-- Hannes
Removing cd $_gitworktree should be ok, we are already in that directory, or don't have a
worktree, and I did that once myself before dropping it as I don't really understand
do_gitk. It should not change any behavior. So, go ahead and add it wherever you wish.

But, I don't understand unsetting GIT_DIR and GIT_WORK_TREE for gitk. If we needed them
for git in the super module, we need them for submodules as well, but have no idea how to
adjust them. Simply unsetting them cannot be right. Out of scope for me. But, there are
some dragons lurking around this proc.

Mark
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help