threads / discuss / 60029

How to make "git bisect visualize" use gitk on Windows?

Subject: How to make "git bisect visualize" use gitk on Windows?

## tl;dr

2 messages between Jul 26, 2023 and Jul 26, 2023.

replies: 1people: 2as markdown or json

Louis Strous· Jul 26, 2023, 09:53 UTC · lore
I use git version 2.41.0.windows.3 on Microsoft Windows 11.  I would like to have "git bisect visualize" use gitk instead of git log, but cannot figure out how to do that.  The documentation at https://git-scm.com/docs/git-bisect says that gitk is the default but "If the DISPLAY environment variable is not set, git log is used instead".  I haven't found a description of what I should set the DISPLAY environment variable to on Windows to get gitk to be used.  I've tried setting it to "whatever" and ":0" but then still got git log instead of gitk.  How do I arrange for "git bisect visualize" to use gitk on Windows?

Regards, Louis Strous

IntelliMagic - Availability Intelligence
T: +31 (0)71-579 6000
www.intellimagic.com
Junio C Hamano· Jul 26, 2023, 16:59 UTC · re: Louis Strous · lore

Re: How to make "git bisect visualize" use gitk on Windows?

Louis Strous <Louis.Strous@intellimagic.com> writes:
Show 10 quoted lines
> I use git version 2.41.0.windows.3 on Microsoft Windows 11.  I
> would like to have "git bisect visualize" use gitk instead of git
> log, but cannot figure out how to do that.  The documentation at
> https://git-scm.com/docs/git-bisect says that gitk is the default
> but "If the DISPLAY environment variable is not set, git log is
> used instead".  I haven't found a description of what I should set
> the DISPLAY environment variable to on Windows to get gitk to be
> used.  I've tried setting it to "whatever" and ":0" but then still
> got git log instead of gitk.  How do I arrange for "git bisect
> visualize" to use gitk on Windows?

There are others who do Windows, but unfortunately I do not. I hope some of them may be able to offer more directly useful suggestions.

But I see the following is in builtin/bisect.c:bisect_visualize():
	if (!argc) {
		if ((getenv("DISPLAY") || getenv("SESSIONNAME") || getenv("MSYSTEM") ||
		     getenv("SECURITYSESSIONID")) && exists_in_PATH("gitk")) {
			strvec_push(&cmd.args, "gitk");
		} else {
			strvec_push(&cmd.args, "log");
			cmd.git_cmd = 1;
		}
	} else {
		if (argv[0][0] == '-') {
			strvec_push(&cmd.args, "log");
			cmd.git_cmd = 1;
		} else if (strcmp(argv[0], "tig") && !starts_with(argv[0], "git"))
			cmd.git_cmd = 1;
		strvec_pushv(&cmd.args, argv);
	}

So presumably "git bisect visualize" (without any other parameter) would invoke "gitk" as long as (1) one of these environment variables are set, regardless of their values, and (2) "gitk" is available on $PATH.

I see on a random stackoverflow page that MSYSTEM is set and exported on MSYS2 default shell, so presumably Git for Windows environment has it already, so whether you have DISPLAY set or unset, the first half of the condition should already be met.

The above code also says that "git bisect visualize -3" would always invoke "log", not "gitk", regardless of the environment settings (I mention this only because from your problem description, I cannot read what exact command line invocation you are having trouble with).

← back to recent threads