threads / discuss / 16069

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

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

## tl;dr

8 messages between Oct 28, 2008 and Oct 29, 2008.

replies: 7people: 3as markdown or json

Hannu Koivisto· Oct 28, 2008, 16:28 UTC · lore
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· Oct 28, 2008, 17:15 UTC · re: Hannu Koivisto · lore

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

Hi,
On Tue, Oct 28, 2008 at 5:28 PM, Hannu Koivisto <azure@iki.fi> wrote:
Show 6 quoted lines
> 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· Oct 28, 2008, 17:51 UTC · re: Christian Couder · lore

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

"Christian Couder" <christian.couder@gmail.com> writes:
Show 12 quoted lines
> 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· Oct 28, 2008, 19:13 UTC · re: Hannu Koivisto · lore

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

On Tue, Oct 28, 2008 at 6:51 PM, Hannu Koivisto <azure@iki.fi> wrote:
Show 21 quoted lines
> "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?

Show 7 quoted lines
> 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· Oct 28, 2008, 22:37 UTC · re: Christian Couder · lore

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

"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.

Show 6 quoted lines
>>> 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· Oct 28, 2008, 23:26 UTC · re: Hannu Koivisto · lore

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

Hannu Koivisto <azure@iki.fi> writes:
Show 11 quoted lines
> "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· Oct 29, 2008, 00:46 UTC · re: Hannu Koivisto · lore

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

Hi,
On Wed, 29 Oct 2008, Hannu Koivisto wrote:
Show 18 quoted lines
> 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· Oct 29, 2008, 13:31 UTC · re: Johannes Schindelin · lore

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

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 6 quoted lines
> 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

← back to recent threads