Skip to content

pr-2346/danudey/fsmonitor-clone-dissociate-worktree-v1

tagged this 02 Dec 20:45
From: Daniel Fox <danudey@me.com>

After "git clone --dissociate" copies the borrowed objects,
dissociate_from_references() runs "git repack -a -d" in a child
process. init_db() exports GIT_DIR, so the child inherits it.
GIT_WORK_TREE is not exported. With GIT_DIR set and no
GIT_WORK_TREE, the child treats its current directory as the top of
the work tree. That directory is the one clone was run from, which
is usually the parent of the new work tree.

Repack itself does not care about the work tree, but it reads the
index. When core.fsmonitor is enabled, reading the index can start
the fsmonitor daemon implicitly. That daemon then watches the wrong
directory and never sees the cookie files that clients create in
the real work tree. As a result, every fsmonitor query in the new
clone waits for the cookie timeout.

When we have a work tree, export it to the child as GIT_WORK_TREE.

Signed-off-by: Daniel Fox <danudey@me.com>

Submitted-As: https://lore.kernel.org/git/pull.2346.git.1796244340074.gitgitgadget@gmail.com
Assets 2
Loading