Move is_<platform> functions to the beginning

We need these in `_which` and they should be defined before that function's definition. This commit is best viewed with `--color-moved`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Johannes Schindelin committed Dec 16, 2022 at 20:41 UTC e0539b4b25310e242d30b91a2c86f5e7a30aade6
1 file changed +31 -27
git-gui.sh
+31 -27
@@ -44,6 +44,37 @@ if {[catch {package require Tcl 8.5} err]
44
45 catch {rename send {}} ; # What an evil concept...
46
47 +######################################################################
48 +##
49 +## Enabling platform-specific code paths
50 +
51 +proc is_MacOSX {} {
52 + if {[tk windowingsystem] eq {aqua}} {
53 + return 1
54 + }
55 + return 0
56 +}
57 +
58 +proc is_Windows {} {
59 + if {$::tcl_platform(platform) eq {windows}} {
60 + return 1
61 + }
62 + return 0
63 +}
64 +
65 +set _iscygwin {}
66 +proc is_Cygwin {} {
67 + global _iscygwin
68 + if {$_iscygwin eq {}} {
69 + if {[string match "CYGWIN_*" $::tcl_platform(os)]} {
70 + set _iscygwin 1
71 + } else {
72 + set _iscygwin 0
73 + }
74 + }
75 + return $_iscygwin
76 +}
77 +
78 ######################################################################
79 ##
80 ## locate our library
@@ -163,7 +194,6 @@ set _isbare {}
194 set _gitexec {}
195 set _githtmldir {}
196 set _reponame {}
166 -set _iscygwin {}
197 set _search_path {}
198 set _shellpath {@@SHELL_PATH@@}
199
@@ -252,32 +282,6 @@ proc reponame {} {
282 return $::_reponame
283 }
284
255 -proc is_MacOSX {} {
256 - if {[tk windowingsystem] eq {aqua}} {
257 - return 1
258 - }
259 - return 0
260 -}
261 -
262 -proc is_Windows {} {
263 - if {$::tcl_platform(platform) eq {windows}} {
264 - return 1
265 - }
266 - return 0
267 -}
268 -
269 -proc is_Cygwin {} {
270 - global _iscygwin
271 - if {$_iscygwin eq {}} {
272 - if {[string match "CYGWIN_*" $::tcl_platform(os)]} {
273 - set _iscygwin 1
274 - } else {
275 - set _iscygwin 0
276 - }
277 - }
278 - return $_iscygwin
279 -}
280 -
285 proc is_enabled {option} {
286 global enabled_options
287 if {[catch {set on $enabled_options($option)}]} {return 0}