aboutsummaryrefslogtreecommitdiff
path: root/gitk-git
diff options
context:
space:
mode:
authorMathias Rav <m@git.strova.dk>2026-03-11 06:44:06 +0000
committerJunio C Hamano <gitster@pobox.com>2026-03-18 12:46:26 -0700
commit57246b7c626c18bad5f7a36b9479dea58b73242d (patch)
treed0e3a4494544c9155d31785d9c12094ffe0cbffd /gitk-git
parent67ad42147a7acc2af6074753ebd03d904476118f (diff)
downloadgit-57246b7c626c18bad5f7a36b9479dea58b73242d.tar.xz
merge-file: fix BUG when --object-id is used in a worktree
The `--object-id` option was added in commit e1068f0ad4 (merge-file: add an option to process object IDs, 2023-11-01) together with a call to setup_git_directory() to avoid crashing when run outside a repository. However, the call to setup_git_directory() is redundant when run inside a repository, as merge-file runs with RUN_SETUP_GENTLY, so the repository has already been set up. The redundant call is harmless when linked worktrees are not used, but in a linked worktree, the repo_set_gitdir() function ends up being called twice. Calling repo_set_gitdir() used to be silently accepted, but commit 2816b748e5 (odb: handle changing a repository's commondir, 2025-11-19) changed this to a BUG in repository.c with the error message: "cannot reinitialize an already-initialized object directory". Guard the redundant call to setup_git_directory() behind a repo pointer check, to ensure that we continue to give the correct "not a git repo" error whilst avoiding the BUG when running in a linked worktree. Signed-off-by: Mathias Rav <m@git.strova.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitk-git')
0 files changed, 0 insertions, 0 deletions