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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

> It's a new regression introduced by 2d92ab32fd (rev-parse: make
> --show-toplevel without a worktree an error, 2019-11-19), as far as I
> can tell. I have many times used gitk on bare repositories as an
> interactive replacement for git-log, so this is a unfortunate bit of
> fallout from that change. That's not to say that 2d92ab32fd should be
> reverted, though... perhaps gitk itself needs a bit of a fix.

Curious.

There is a "proc gitworktree" that does use --show-toplevel but it
is fairly conservative and assumes these calls can fail.

    ...
    if {[catch {set _gitworktree [exec git rev-parse --show-toplevel]}]} {
        if {[catch { set _gitworktree $env(GIT_WORK_TREE) }]} {
	    catch {set _gitworktree [exec git config --get core.worktree]}
	    if {$_gitworktree eq ""} {
		set _gitworktree [file normalize ./[exec git rev-parse --show-cdup]]
	    }

However, there is this call

    set worktree [exec git rev-parse --show-toplevel]

at the top-level of the code.  I wonder if the obvious and minimum
fix would be sufficient, i.e.

    -set worktree [exec git rev-parse --show-toplevel]
    +set worktree [gitworktree]

around l.12546



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux