Subject: Re: [REGRESSION] gitk can't be run from non-worktree folders

From: SZEDER Gábor <[email-masked]>
Date: Thu, 23 Jan 2020 17:31:51 +0100

On Thu, Jan 23, 2020 at 05:04:09PM +0100, ch wrote:
> I recently updated my Git installation from 2.24.1.windows.2 to
> 2.25.0.windows.1 and from the looks of it the included version of gitk does not
> support being run from non-worktree folders of a repository anymore (like the
> .git folder for example).
> 
> Here's a small reproduction recipe:
> 
>   $ git init repro
>   $ cd repro
>   $ git commit -m test --allow-empty
>   $ cd .git
>   $ gitk --all &
> 
> gitk terminates with the message:
> 
>   fatal: this operation must be run in a work tree
>       while executing
>   "exec git rev-parse --show-toplevel"
>       invoked from within
>   "set worktree [exec git rev-parse --show-toplevel]"
>       (file "C:/Program Files/Git/mingw64/bin/gitk" line 12634)

I've stumbled upon the same issue when I tried to run 'gitk' in a bare
repository a while ago, but it refused to run with the same error
message.

Are you sure it's a recent regression?  I have no experience with
'gitk' in Git for Windows, but on Linux this has been broken for quite
some time, namely since 784b7e2f25 (gitk: Fix "External diff" with
separate work tree, 2011-04-04) in the v1.7 era.  FWIW, reverting that
commit on top of v2.25.0 makes 'gitk' work again in bare repositories.