Skip to content

Commit e25cbdf

Browse files
committed
Merge branch 'ml/cygwin-fixes'
Remove some code supporting ancient Cygwin Tcl/Tk versions. Also fix exploring working directory and making desktop shortcuts on Cygwin. * ml/cygwin-fixes: git-gui - use mkshortcut on Cygwin git-gui - use cygstart to browse on Cygwin git-gui - remove obsolete Cygwin specific code git gui Makefile - remove Cygwin modifications
2 parents a5005de + b85c5a4 commit e25cbdf

File tree

4 files changed

+27
-170
lines changed

4 files changed

+27
-170
lines changed

Makefile

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,10 @@ GITGUI_SCRIPT := $$0
138138
GITGUI_RELATIVE :=
139139
GITGUI_MACOSXAPP :=
140140

141-
ifeq ($(uname_O),Cygwin)
142-
GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
143-
144-
# Is this a Cygwin Tcl/Tk binary? If so it knows how to do
145-
# POSIX path translation just like cygpath does and we must
146-
# keep libdir in POSIX format so Cygwin packages of git-gui
147-
# work no matter where the user installs them.
148-
#
149-
ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
150-
gg_libdir_sed_in := $(gg_libdir)
151-
else
152-
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
153-
endif
154-
else
155-
ifeq ($(exedir),$(gg_libdir))
156-
GITGUI_RELATIVE := 1
157-
endif
158-
gg_libdir_sed_in := $(gg_libdir)
141+
ifeq ($(exedir),$(gg_libdir))
142+
GITGUI_RELATIVE := 1
159143
endif
144+
gg_libdir_sed_in := $(gg_libdir)
160145
ifeq ($(uname_S),Darwin)
161146
ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y)
162147
GITGUI_MACOSXAPP := YesPlease

git-gui.sh

Lines changed: 9 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,7 @@ proc _which {what args} {
8484
global env _search_exe _search_path
8585

8686
if {$_search_path eq {}} {
87-
if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} {
88-
set _search_path [split [exec cygpath \
89-
--windows \
90-
--path \
91-
--absolute \
92-
$env(PATH)] {;}]
93-
set _search_exe .exe
94-
} elseif {[is_Windows]} {
87+
if {[is_Windows]} {
9588
set gitguidir [file dirname [info script]]
9689
regsub -all ";" $gitguidir "\\;" gitguidir
9790
set env(PATH) "$gitguidir;$env(PATH)"
@@ -342,14 +335,7 @@ proc gitexec {args} {
342335
if {[catch {set _gitexec [git --exec-path]} err]} {
343336
error "Git not installed?\n\n$err"
344337
}
345-
if {[is_Cygwin]} {
346-
set _gitexec [exec cygpath \
347-
--windows \
348-
--absolute \
349-
$_gitexec]
350-
} else {
351-
set _gitexec [file normalize $_gitexec]
352-
}
338+
set _gitexec [file normalize $_gitexec]
353339
}
354340
if {$args eq {}} {
355341
return $_gitexec
@@ -364,14 +350,7 @@ proc githtmldir {args} {
364350
# Git not installed or option not yet supported
365351
return {}
366352
}
367-
if {[is_Cygwin]} {
368-
set _githtmldir [exec cygpath \
369-
--windows \
370-
--absolute \
371-
$_githtmldir]
372-
} else {
373-
set _githtmldir [file normalize $_githtmldir]
374-
}
353+
set _githtmldir [file normalize $_githtmldir]
375354
}
376355
if {$args eq {}} {
377356
return $_githtmldir
@@ -1318,9 +1297,6 @@ if {$_gitdir eq "."} {
13181297
set _gitdir [pwd]
13191298
}
13201299

1321-
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
1322-
catch {set _gitdir [exec cygpath --windows $_gitdir]}
1323-
}
13241300
if {![file isdirectory $_gitdir]} {
13251301
catch {wm withdraw .}
13261302
error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"]
@@ -1332,11 +1308,7 @@ apply_config
13321308

13331309
# v1.7.0 introduced --show-toplevel to return the canonical work-tree
13341310
if {[package vcompare $_git_version 1.7.0] >= 0} {
1335-
if { [is_Cygwin] } {
1336-
catch {set _gitworktree [exec cygpath --windows [git rev-parse --show-toplevel]]}
1337-
} else {
1338-
set _gitworktree [git rev-parse --show-toplevel]
1339-
}
1311+
set _gitworktree [git rev-parse --show-toplevel]
13401312
} else {
13411313
# try to set work tree from environment, core.worktree or use
13421314
# cdup to obtain a relative path to the top of the worktree. If
@@ -1561,24 +1533,8 @@ proc rescan {after {honor_trustmtime 1}} {
15611533
}
15621534
}
15631535

1564-
if {[is_Cygwin]} {
1565-
set is_git_info_exclude {}
1566-
proc have_info_exclude {} {
1567-
global is_git_info_exclude
1568-
1569-
if {$is_git_info_exclude eq {}} {
1570-
if {[catch {exec test -f [gitdir info exclude]}]} {
1571-
set is_git_info_exclude 0
1572-
} else {
1573-
set is_git_info_exclude 1
1574-
}
1575-
}
1576-
return $is_git_info_exclude
1577-
}
1578-
} else {
1579-
proc have_info_exclude {} {
1580-
return [file readable [gitdir info exclude]]
1581-
}
1536+
proc have_info_exclude {} {
1537+
return [file readable [gitdir info exclude]]
15821538
}
15831539

15841540
proc rescan_stage2 {fd after} {
@@ -2318,7 +2274,9 @@ proc do_git_gui {} {
23182274

23192275
# Get the system-specific explorer app/command.
23202276
proc get_explorer {} {
2321-
if {[is_Cygwin] || [is_Windows]} {
2277+
if {[is_Cygwin]} {
2278+
set explorer "/bin/cygstart.exe --explore"
2279+
} elseif {[is_Windows]} {
23222280
set explorer "explorer.exe"
23232281
} elseif {[is_MacOSX]} {
23242282
set explorer "open"
@@ -3112,10 +3070,6 @@ if {[is_MacOSX]} {
31123070
set doc_path [githtmldir]
31133071
if {$doc_path ne {}} {
31143072
set doc_path [file join $doc_path index.html]
3115-
3116-
if {[is_Cygwin]} {
3117-
set doc_path [exec cygpath --mixed $doc_path]
3118-
}
31193073
}
31203074

31213075
if {[file isfile $doc_path]} {
@@ -4087,60 +4041,6 @@ set file_lists($ui_workdir) [list]
40874041
wm title . "[appname] ([reponame]) [file normalize $_gitworktree]"
40884042
focus -force $ui_comm
40894043

4090-
# -- Warn the user about environmental problems. Cygwin's Tcl
4091-
# does *not* pass its env array onto any processes it spawns.
4092-
# This means that git processes get none of our environment.
4093-
#
4094-
if {[is_Cygwin]} {
4095-
set ignored_env 0
4096-
set suggest_user {}
4097-
set msg [mc "Possible environment issues exist.
4098-
4099-
The following environment variables are probably
4100-
going to be ignored by any Git subprocess run
4101-
by %s:
4102-
4103-
" [appname]]
4104-
foreach name [array names env] {
4105-
switch -regexp -- $name {
4106-
{^GIT_INDEX_FILE$} -
4107-
{^GIT_OBJECT_DIRECTORY$} -
4108-
{^GIT_ALTERNATE_OBJECT_DIRECTORIES$} -
4109-
{^GIT_DIFF_OPTS$} -
4110-
{^GIT_EXTERNAL_DIFF$} -
4111-
{^GIT_PAGER$} -
4112-
{^GIT_TRACE$} -
4113-
{^GIT_CONFIG$} -
4114-
{^GIT_(AUTHOR|COMMITTER)_DATE$} {
4115-
append msg " - $name\n"
4116-
incr ignored_env
4117-
}
4118-
{^GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)$} {
4119-
append msg " - $name\n"
4120-
incr ignored_env
4121-
set suggest_user $name
4122-
}
4123-
}
4124-
}
4125-
if {$ignored_env > 0} {
4126-
append msg [mc "
4127-
This is due to a known issue with the
4128-
Tcl binary distributed by Cygwin."]
4129-
4130-
if {$suggest_user ne {}} {
4131-
append msg [mc "
4132-
4133-
A good replacement for %s
4134-
is placing values for the user.name and
4135-
user.email settings into your personal
4136-
~/.gitconfig file.
4137-
" $suggest_user]
4138-
}
4139-
warn_popup $msg
4140-
}
4141-
unset ignored_env msg suggest_user name
4142-
}
4143-
41444044
# -- Only initialize complex UI if we are going to stay running.
41454045
#
41464046
if {[is_enabled transport]} {

lib/choose_repository.tcl

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ constructor pick {} {
174174
-foreground blue \
175175
-underline 1
176176
set home $::env(HOME)
177-
if {[is_Cygwin]} {
178-
set home [exec cygpath --windows --absolute $home]
179-
}
180177
set home "[file normalize $home]/"
181178
set hlen [string length $home]
182179
foreach p $sorted_recent {
@@ -374,18 +371,6 @@ proc _objdir {path} {
374371
return $objdir
375372
}
376373

377-
if {[is_Cygwin]} {
378-
set objdir [file join $path .git objects.lnk]
379-
if {[file isfile $objdir]} {
380-
return [win32_read_lnk $objdir]
381-
}
382-
383-
set objdir [file join $path objects.lnk]
384-
if {[file isfile $objdir]} {
385-
return [win32_read_lnk $objdir]
386-
}
387-
}
388-
389374
return {}
390375
}
391376

@@ -623,12 +608,6 @@ method _do_clone2 {} {
623608
}
624609

625610
set giturl $origin_url
626-
if {[is_Cygwin] && [file isdirectory $giturl]} {
627-
set giturl [exec cygpath --unix --absolute $giturl]
628-
if {$clone_type eq {shared}} {
629-
set objdir [exec cygpath --unix --absolute $objdir]
630-
}
631-
}
632611

633612
if {[file exists $local_path]} {
634613
error_popup [mc "Location %s already exists." $local_path]
@@ -668,11 +647,7 @@ method _do_clone2 {} {
668647
fconfigure $f_cp -translation binary -encoding binary
669648
cd $objdir
670649
while {[gets $f_in line] >= 0} {
671-
if {[is_Cygwin]} {
672-
puts $f_cp [exec cygpath --unix --absolute $line]
673-
} else {
674-
puts $f_cp [file normalize $line]
675-
}
650+
puts $f_cp [file normalize $line]
676651
}
677652
close $f_in
678653
close $f_cp

lib/shortcut.tcl

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,10 @@ proc do_windows_shortcut {} {
2727
}
2828

2929
proc do_cygwin_shortcut {} {
30-
global argv0 _gitworktree
30+
global argv0 _gitworktree oguilib
3131

3232
if {[catch {
3333
set desktop [exec cygpath \
34-
--windows \
35-
--absolute \
36-
--long-name \
3734
--desktop]
3835
}]} {
3936
set desktop .
@@ -48,19 +45,19 @@ proc do_cygwin_shortcut {} {
4845
set fn ${fn}.lnk
4946
}
5047
if {[catch {
51-
set sh [exec cygpath \
52-
--windows \
53-
--absolute \
54-
/bin/sh.exe]
55-
set me [exec cygpath \
56-
--unix \
57-
--absolute \
58-
$argv0]
59-
win32_create_lnk $fn [list \
60-
$sh -c \
61-
"CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
62-
] \
63-
[file normalize $_gitworktree]
48+
set repodir [file normalize $_gitworktree]
49+
set shargs {-c \
50+
"CHERE_INVOKING=1 \
51+
source /etc/profile; \
52+
git gui"}
53+
exec /bin/mkshortcut.exe \
54+
--arguments $shargs \
55+
--desc "git-gui on $repodir" \
56+
--icon $oguilib/git-gui.ico \
57+
--name $fn \
58+
--show min \
59+
--workingdir $repodir \
60+
/bin/sh.exe
6461
} err]} {
6562
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
6663
}

0 commit comments

Comments
 (0)