git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 26, 2023, 16:59 UTC
Message-ID
<xmqq4jlqehh4.fsf@gitster.g>
In-Reply-To
<VI1PR10MB2462F7B52FF2E3F59AFE94A7F500A@VI1PR10MB2462.EURPRD10.PROD.OUTLOOK.COM>
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).

Previous: Louis Strous
Message 2 of 2 in “How to make "git bisect visualize" use gitk on Windows?”
  1. Louis StrousJul 26, 2023
  2. Junio C HamanoJul 26, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.