# git bisect view's use of DISPLAY environment variable in Cygwin

8 messages from 2008-10-28 to 2008-10-29. Participants: Hannu Koivisto, Christian Couder, Johannes Schindelin.
Thread: https://gitlist.dev/t/16069

## Hannu Koivisto, 2008-10-28 16:28

Subject: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <83wsfs1y6v.fsf@kalahari.s2.org>
URL: https://gitlist.dev/e/83wsfs1y6v.fsf%40kalahari.s2.org

```
Greetings,

git bisect view uses gitk if DISPLAY environment variable is set
and git log otherwise.  Since gitk doesn't require X server in
Cygwin, that seems like a bit questionable condition in that
environment.

I'd prefer it to use gitk unless an option given.  I think an
option would be preferable (to DISPLAY= git bisect view) in Unix as
well if you have DISPLAY set but you want it to use git log.

-- 
Hannu

```

## Christian Couder, 2008-10-28 17:15

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <c07716ae0810281015s47741fdqec4c3bed3313bb6a@mail.gmail.com>
URL: https://gitlist.dev/e/c07716ae0810281015s47741fdqec4c3bed3313bb6a%40mail.gmail.com
In-Reply-To: <83wsfs1y6v.fsf@kalahari.s2.org>

```
Hi,

On Tue, Oct 28, 2008 at 5:28 PM, Hannu Koivisto <azure@iki.fi> wrote:
> Greetings,
>
> git bisect view uses gitk if DISPLAY environment variable is set
> and git log otherwise.  Since gitk doesn't require X server in
> Cygwin, that seems like a bit questionable condition in that
> environment.

Do you know any environment variable that we could use to detect we
can use gitk in Cygwin?
In this case a patch seems trivial.

> I'd prefer it to use gitk unless an option given.  I think an
> option would be preferable (to DISPLAY= git bisect view) in Unix as
> well if you have DISPLAY set but you want it to use git log.

You can use "git bisect view log" to use "git log" even if DISPLAY is set.

Regards,
Christian.

```

## Hannu Koivisto, 2008-10-28 17:51

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <83skqg1uc9.fsf@kalahari.s2.org>
URL: https://gitlist.dev/e/83skqg1uc9.fsf%40kalahari.s2.org
In-Reply-To: <c07716ae0810281015s47741fdqec4c3bed3313bb6a@mail.gmail.com>

```
"Christian Couder" <christian.couder@gmail.com> writes:

> Hi,
>
> On Tue, Oct 28, 2008 at 5:28 PM, Hannu Koivisto <azure@iki.fi> wrote:
>> Greetings,
>>
>> git bisect view uses gitk if DISPLAY environment variable is set
>> and git log otherwise.  Since gitk doesn't require X server in
>> Cygwin, that seems like a bit questionable condition in that
>> environment.
>
> Do you know any environment variable that we could use to detect we
> can use gitk in Cygwin?

I looked around and I believe there is no such variable.  I suppose
the only case where you cannot use gitk is when the user is logged
on using ssh, telnet, psexec or similar (well, unless you use some
non-standard Tcl/Tk build which is configured to use X instead of
Windows graphics).  Then again, I don't think typical Windows
programs do any checks for such situations.

So, easy fix: always use gitk unless log is specified.  Harder fix:
figure out a way to test if the login session is such that
graphical applications can be run.

> You can use "git bisect view log" to use "git log" even if DISPLAY is set.

I'd rather not use undocumented functionality ;)

-- 
Hannu

```

## Christian Couder, 2008-10-28 19:13

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <c07716ae0810281213k432d82d8i468f54ae03146b88@mail.gmail.com>
URL: https://gitlist.dev/e/c07716ae0810281213k432d82d8i468f54ae03146b88%40mail.gmail.com
In-Reply-To: <83skqg1uc9.fsf@kalahari.s2.org>

```
On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
> "Christian Couder" <christian.couder@gmail.com> writes:
>
>> Hi,
>>
>> On Tue, Oct 28, 2008 at 5:28 PM, Hannu Koivisto <azure@iki.fi> wrote:
>>> Greetings,
>>>
>>> git bisect view uses gitk if DISPLAY environment variable is set
>>> and git log otherwise.  Since gitk doesn't require X server in
>>> Cygwin, that seems like a bit questionable condition in that
>>> environment.
>>
>> Do you know any environment variable that we could use to detect we
>> can use gitk in Cygwin?
>
> I looked around and I believe there is no such variable.  I suppose
> the only case where you cannot use gitk is when the user is logged
> on using ssh, telnet, psexec or similar (well, unless you use some
> non-standard Tcl/Tk build which is configured to use X instead of
> Windows graphics).  Then again, I don't think typical Windows
> programs do any checks for such situations.

We need at least a way to detect we are under Cygwin, because we won't
change the current behavior for all platforms.
Is checking for the CYGWIN environment variable enough?

> So, easy fix: always use gitk unless log is specified.  Harder fix:
> figure out a way to test if the login session is such that
> graphical applications can be run.
>
>> You can use "git bisect view log" to use "git log" even if DISPLAY is set.
>
> I'd rather not use undocumented functionality ;)

In this case you can use any "git log" option after "git bisect view"
(for example: git bisect view -p).

Regards,
Christian.

```

## Hannu Koivisto, 2008-10-28 22:37

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <83iqrccpmk.fsf@kalahari.s2.org>
URL: https://gitlist.dev/e/83iqrccpmk.fsf%40kalahari.s2.org
In-Reply-To: <c07716ae0810281213k432d82d8i468f54ae03146b88@mail.gmail.com>

```
"Christian Couder" <christian.couder@gmail.com> writes:

> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
>> "Christian Couder" <christian.couder@gmail.com> writes:

> We need at least a way to detect we are under Cygwin, because we won't
> change the current behavior for all platforms.
> Is checking for the CYGWIN environment variable enough?

No, because it may not be set.  I would probably do it at compile
time using __CYGWIN__ definition.  I don't know what's the status
of merging MSysGit with "official" git but I suppose that when that
happens, __MING32__ and/or _WIN32 or something would need to be
considered as well.

>>> You can use "git bisect view log" to use "git log" even if DISPLAY is set.
>>
>> I'd rather not use undocumented functionality ;)
>
> In this case you can use any "git log" option after "git bisect view"
> (for example: git bisect view -p).

I was implying that "log" after "git bisect view" is not documented
by git-bisect(1).  "log" is not a "git log" option.

-- 
Hannu

```

## Hannu Koivisto, 2008-10-28 23:26

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <83ej20cndw.fsf@kalahari.s2.org>
URL: https://gitlist.dev/e/83ej20cndw.fsf%40kalahari.s2.org
In-Reply-To: <83iqrccpmk.fsf@kalahari.s2.org>

```
Hannu Koivisto <azure@iki.fi> writes:

> "Christian Couder" <christian.couder@gmail.com> writes:
>
>> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
>>> "Christian Couder" <christian.couder@gmail.com> writes:
>
>> We need at least a way to detect we are under Cygwin, because we won't
>> change the current behavior for all platforms.
>> Is checking for the CYGWIN environment variable enough?
>
> No, because it may not be set.  I would probably do it at compile
> time using __CYGWIN__ definition.  I don't know what's the status

Argh, I didn't realize git-bisect is a shell script.  For detecting
Cygwin in shell scripts I have tested if `uname` matches CYGWIN*.
For detecting Windows I have tested if PROCESSOR_ARCHITECTURE is
set.  There may well be better ways.

-- 
Hannu

```

## Johannes Schindelin, 2008-10-29 00:46

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <alpine.DEB.1.00.0810290144450.22125@pacific.mpi-cbg.de.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0810290144450.22125%40pacific.mpi-cbg.de.mpi-cbg.de
In-Reply-To: <83ej20cndw.fsf@kalahari.s2.org>

```
Hi,

On Wed, 29 Oct 2008, Hannu Koivisto wrote:

> Hannu Koivisto <azure@iki.fi> writes:
> 
> > "Christian Couder" <christian.couder@gmail.com> writes:
> >
> >> On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
> >>> "Christian Couder" <christian.couder@gmail.com> writes:
> >
> >> We need at least a way to detect we are under Cygwin, because we 
> >> won't change the current behavior for all platforms. Is checking for 
> >> the CYGWIN environment variable enough?
> >
> > No, because it may not be set.  I would probably do it at compile time 
> > using __CYGWIN__ definition.  I don't know what's the status
> 
> Argh, I didn't realize git-bisect is a shell script.  For detecting 
> Cygwin in shell scripts I have tested if `uname` matches CYGWIN*. For 
> detecting Windows I have tested if PROCESSOR_ARCHITECTURE is set.  
> There may well be better ways.

I submitted a patch a while ago, saying

	bisect view: call gitk if Cygwin's SESSIONNAME variable is set

See 
http://repo.or.cz/w/git/dscho.git?a=commitdiff;h=a2637a3a003646c69ab5a6b85f0ee1bfac15e0b0

Ciao,
Dscho

```

## Hannu Koivisto, 2008-10-29 13:31

Subject: Re: git bisect view's use of DISPLAY environment variable in Cygwin
Message-ID: <83abcncyue.fsf@kalahari.s2.org>
URL: https://gitlist.dev/e/83abcncyue.fsf%40kalahari.s2.org
In-Reply-To: <alpine.DEB.1.00.0810290144450.22125@pacific.mpi-cbg.de.mpi-cbg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> I submitted a patch a while ago, saying
>
> 	bisect view: call gitk if Cygwin's SESSIONNAME variable is set
>
> See 
> http://repo.or.cz/w/git/dscho.git?a=commitdiff;h=a2637a3a003646c69ab5a6b85f0ee1bfac15e0b0

Unfortunately this approach doesn't seem to work if you run git
bisect view from, say, cmd (probably applies to other non-Cygwin
shells as well).  I'm puzzled as to why this happens; I wrote a
simple shell script that echoes $SESSIONNAME and no matter how I
run it from cmd it always echoes Console.

It's certainly better than nothing and I wouldn't mind it ending up
to the official git but...

-- 
Hannu

```
