@@ -36,6 +36,24 @@ if {[catch {package require Tcl 8.4} err]
36
36
exit 1
37
37
}
38
38
39
+ # #####################################################################
40
+ # #
41
+ # # enable verbose loading?
42
+
43
+ if {![catch {set _verbose $env(GITGUI_VERBOSE) }]} {
44
+ unset _verbose
45
+ rename auto_load real__auto_load
46
+ proc auto_load {name args} {
47
+ puts stderr " auto_load $name "
48
+ return [uplevel 1 real__auto_load $name $args ]
49
+ }
50
+ rename source real__source
51
+ proc source {name} {
52
+ puts stderr " source $name "
53
+ uplevel 1 real__source $name
54
+ }
55
+ }
56
+
39
57
# #####################################################################
40
58
# #
41
59
# # configure our library
@@ -48,48 +66,41 @@ if {$oguirel eq {1}} {
48
66
} elseif {[string match @@* $oguirel ]} {
49
67
set oguilib [file join [file dirname [file normalize $argv0 ]] lib]
50
68
}
69
+
51
70
set idx [file join $oguilib tclIndex]
52
- catch {
53
- set fd [open $idx r]
54
- if {[gets $fd ] eq {# Autogenerated by git-gui Makefile}} {
55
- set idx [list ]
56
- while {[gets $fd n] >= 0} {
57
- if {$n ne {} && ![string match #* $n ]} {
58
- lappend idx $n
59
- }
71
+ if {[catch {set fd [open $idx r]} err]} {
72
+ catch {wm withdraw .}
73
+ tk_messageBox \
74
+ -icon error \
75
+ -type ok \
76
+ -title " git-gui: fatal error" \
77
+ -message $err
78
+ exit 1
79
+ }
80
+ if {[gets $fd ] eq {# Autogenerated by git-gui Makefile}} {
81
+ set idx [list ]
82
+ while {[gets $fd n] >= 0} {
83
+ if {$n ne {} && ![string match #* $n ]} {
84
+ lappend idx $n
60
85
}
61
- } else {
62
- set idx {}
63
86
}
64
- close $fd
87
+ } else {
88
+ set idx {}
65
89
}
90
+ close $fd
91
+
66
92
if {$idx ne {}} {
67
93
set loaded [list ]
68
94
foreach p $idx {
69
95
if {[lsearch -exact $loaded $p ] >= 0} continue
70
- puts $p
71
96
source [file join $oguilib $p ]
72
97
lappend loaded $p
73
98
}
74
99
unset loaded p
75
100
} else {
76
101
set auto_path [concat [list $oguilib ] $auto_path ]
77
102
}
78
- unset -nocomplain oguilib oguirel idx fd
79
-
80
- if {![catch {set _verbose $env(GITGUI_VERBOSE) }]} {
81
- unset _verbose
82
- rename auto_load real__auto_load
83
- proc auto_load {name args} {
84
- puts stderr " auto_load $name "
85
- return [uplevel 1 real__auto_load $name $args ]
86
- }
87
- rename source real__source
88
- proc source {name} {
89
- puts stderr " source $name "
90
- uplevel 1 real__source $name
91
- }
92
- }
103
+ unset -nocomplain oguirel idx fd
93
104
94
105
# #####################################################################
95
106
# #
@@ -205,6 +216,15 @@ proc is_config_true {name} {
205
216
}
206
217
}
207
218
219
+ proc get_config {name} {
220
+ global repo_config
221
+ if {[catch {set v $repo_config($name) }]} {
222
+ return {}
223
+ } else {
224
+ return $v
225
+ }
226
+ }
227
+
208
228
proc load_config {include_global} {
209
229
global repo_config global_config default_config
210
230
@@ -258,6 +278,17 @@ proc git {args} {
258
278
return [eval exec git $args ]
259
279
}
260
280
281
+ proc current-branch {} {
282
+ set ref {}
283
+ set fd [open [gitdir HEAD] r]
284
+ if {[gets $fd ref] <16
285
+ || ![regsub {^ref: refs/heads/} $ref {} ref]} {
286
+ set ref {}
287
+ }
288
+ close $fd
289
+ return $ref
290
+ }
291
+
261
292
auto_load tk_optionMenu
262
293
rename tk_optionMenu real__tkOptionMenu
263
294
proc tk_optionMenu {w varName args} {
@@ -406,15 +437,7 @@ proc repository_state {ctvar hdvar mhvar} {
406
437
407
438
set mh [list ]
408
439
409
- if {[catch {set current_branch [git symbolic-ref HEAD]}]} {
410
- set current_branch {}
411
- } else {
412
- regsub ^refs/((heads|tags|remotes)/)? \
413
- $current_branch \
414
- {} \
415
- current_branch
416
- }
417
-
440
+ set current_branch [current-branch]
418
441
if {[catch {set hd [git rev-parse --verify HEAD]}]} {
419
442
set hd {}
420
443
set ct initial
@@ -1229,6 +1252,10 @@ foreach class {Button Checkbutton Entry Label
1229
1252
}
1230
1253
unset class
1231
1254
1255
+ if {[is_Windows] || [is_MacOSX]} {
1256
+ option add *Menu.tearOff 0
1257
+ }
1258
+
1232
1259
if {[is_MacOSX]} {
1233
1260
set M1B M1
1234
1261
set M1T Cmd
@@ -1259,11 +1286,13 @@ proc apply_config {} {
1259
1286
}
1260
1287
}
1261
1288
1289
+ set default_config(merge.diffstat) true
1262
1290
set default_config(merge.summary) false
1263
1291
set default_config(merge.verbosity) 2
1264
1292
set default_config(user.name) {}
1265
1293
set default_config(user.email) {}
1266
1294
1295
+ set default_config(gui.pruneduringfetch) false
1267
1296
set default_config(gui.trustmtime) false
1268
1297
set default_config(gui.diffcontext) 5
1269
1298
set default_config(gui.newbranchtemplate) {}
@@ -1425,6 +1454,11 @@ if {[is_enabled branch]} {
1425
1454
lappend disable_on_lock [list .mbar.branch entryconf \
1426
1455
[.mbar.branch index last] -state]
1427
1456
1457
+ .mbar.branch add command -label {Rename...} \
1458
+ -command branch_rename::dialog
1459
+ lappend disable_on_lock [list .mbar.branch entryconf \
1460
+ [.mbar.branch index last] -state]
1461
+
1428
1462
.mbar.branch add command -label {Delete...} \
1429
1463
-command do_delete_branch
1430
1464
lappend disable_on_lock [list .mbar.branch entryconf \
@@ -1522,6 +1556,8 @@ if {[is_enabled transport]} {
1522
1556
menu .mbar.push
1523
1557
.mbar.push add command -label {Push...} \
1524
1558
-command do_push_anywhere
1559
+ .mbar.push add command -label {Delete...} \
1560
+ -command remote_branch_delete::dialog
1525
1561
}
1526
1562
1527
1563
if {[is_MacOSX]} {
@@ -1639,14 +1675,8 @@ switch -- $subcommand {
1639
1675
browser {
1640
1676
set subcommand_args {rev?}
1641
1677
switch [llength $argv ] {
1642
- 0 {
1643
- set current_branch [git symbolic-ref HEAD]
1644
- regsub ^refs/((heads|tags|remotes)/)? \
1645
- $current_branch {} current_branch
1646
- }
1647
- 1 {
1648
- set current_branch [lindex $argv 0]
1649
- }
1678
+ 0 { set current_branch [current-branch] }
1679
+ 1 { set current_branch [lindex $argv 0] }
1650
1680
default usage
1651
1681
}
1652
1682
browser::new $current_branch
@@ -1679,9 +1709,7 @@ blame {
1679
1709
unset is_path
1680
1710
1681
1711
if {$head eq {}} {
1682
- set current_branch [git symbolic-ref HEAD]
1683
- regsub ^refs/((heads|tags|remotes)/)? \
1684
- $current_branch {} current_branch
1712
+ set current_branch [current-branch]
1685
1713
} else {
1686
1714
set current_branch $head
1687
1715
}
0 commit comments