Skip to content

Commit 0e8243a

Browse files
committed
Merge branch 'master' of https://github.com/j6t/git-gui
* 'master' of https://github.com/j6t/git-gui: (26 commits) git-gui: eliminate _search_exe git-gui: remove procs gitexec and _git_cmd git-gui: use dashless 'git cmd' form for read/write git-gui: default to full copy for linked worktrees git-gui: use git-clone git-gui: remove non-ttk code git-gui: remove ${NS} indirection for ttk git-gui: always use themed widgets from ttk git-gui: remove redundant check for Tk >= 8.5 git-gui: remove unreachable Tk 8.4 code git-gui: remove unused git-version git-gui: use git_init to create new repository dir git-gui: git-remote is always available git-gui: git merge understands --strategy=recursive git-gui: git-diff knows submodules and textconv git-gui: git-blame understands -w and textconv git-gui: git rev-parse knows show_toplevel git-gui: use git-branch --show-current git-gui: git-diff-index always knows submodules git-gui: git ls-files knows --exclude-standard ...
2 parents afea220 + 436dad0 commit 0e8243a

32 files changed

+2273
-3063
lines changed

git-gui/git-gui.sh

Lines changed: 94 additions & 313 deletions
Large diffs are not rendered by default.

git-gui/lib/about.tcl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
proc do_about {} {
55
global appvers copyright oguilib
66
global tcl_patchLevel tk_patchLevel
7-
global ui_comm_spell NS use_ttk
7+
global ui_comm_spell
88

99
set w .about_dialog
1010
Dialog $w
1111
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
1212

1313
pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
14-
${NS}::label $w.header -text [mc "About %s" [appname]] \
14+
ttk::label $w.header -text [mc "About %s" [appname]] \
1515
-font font_uibold -anchor center
1616
pack $w.header -side top -fill x
1717

18-
${NS}::frame $w.buttons
19-
${NS}::button $w.buttons.close -text {Close} \
18+
ttk::frame $w.buttons
19+
ttk::button $w.buttons.close -text {Close} \
2020
-default active \
2121
-command [list destroy $w]
2222
pack $w.buttons.close -side right
@@ -44,7 +44,7 @@ proc do_about {} {
4444

4545
set d {}
4646
append d "git wrapper: $::_git\n"
47-
append d "git exec dir: [gitexec]\n"
47+
append d "git exec dir: [git --exec-path]\n"
4848
append d "git-gui lib: $oguilib"
4949

5050
paddedlabel $w.vers -text $v

git-gui/lib/blame.tcl

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ field tooltip_timer {} ; # Current timer event for our tooltip
6363
field tooltip_commit {} ; # Commit(s) in tooltip
6464

6565
constructor new {i_commit i_path i_jump} {
66-
global cursor_ptr M1B M1T have_tk85 use_ttk NS
66+
global cursor_ptr M1B M1T
6767
variable active_color
6868
variable group_colors
6969

@@ -203,18 +203,17 @@ constructor new {i_commit i_path i_jump} {
203203
-width 80 \
204204
-xscrollcommand [list $w.file_pane.out.sbx set] \
205205
-font font_diff
206-
if {$have_tk85} {
207206
$w_file configure -inactiveselectbackground darkblue
208-
}
207+
209208
$w_file tag conf found \
210209
-background yellow
211210

212211
set w_columns [list $w_amov $w_asim $w_line $w_file]
213212

214-
${NS}::scrollbar $w.file_pane.out.sbx \
213+
ttk::scrollbar $w.file_pane.out.sbx \
215214
-orient h \
216215
-command [list $w_file xview]
217-
${NS}::scrollbar $w.file_pane.out.sby \
216+
ttk::scrollbar $w.file_pane.out.sby \
218217
-orient v \
219218
-command [list scrollbar2many $w_columns yview]
220219
eval grid $w_columns $w.file_pane.out.sby -sticky nsew
@@ -264,10 +263,10 @@ constructor new {i_commit i_path i_jump} {
264263
-background $active_color \
265264
-font font_ui
266265
$w_cviewer tag raise sel
267-
${NS}::scrollbar $w.file_pane.cm.sbx \
266+
ttk::scrollbar $w.file_pane.cm.sbx \
268267
-orient h \
269268
-command [list $w_cviewer xview]
270-
${NS}::scrollbar $w.file_pane.cm.sby \
269+
ttk::scrollbar $w.file_pane.cm.sby \
271270
-orient v \
272271
-command [list $w_cviewer yview]
273272
pack $w.file_pane.cm.sby -side right -fill y
@@ -426,6 +425,7 @@ method _kill {} {
426425

427426
method _load {jump} {
428427
variable group_colors
428+
global hashlength
429429

430430
_hide_tooltip $this
431431

@@ -436,7 +436,7 @@ method _load {jump} {
436436
$i conf -state normal
437437
$i delete 0.0 end
438438
foreach g [$i tag names] {
439-
if {[regexp {^g[0-9a-f]{40}$} $g]} {
439+
if {[regexp [string map "@@ $hashlength" {^g[0-9a-f]{@@}$}] $g]} {
440440
$i tag delete $g
441441
}
442442
}
@@ -470,7 +470,7 @@ method _load {jump} {
470470
$w_path conf -text [escape_path $path]
471471

472472
set do_textconv 0
473-
if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} {
473+
if {![is_config_false gui.textconv]} {
474474
set filter [gitattr $path diff set]
475475
set textconv [get_config [join [list diff $filter textconv] .]]
476476
if {$filter ne {set} && $textconv ne {}} {
@@ -500,6 +500,8 @@ method _load {jump} {
500500
}
501501

502502
method _history_menu {} {
503+
global hashlength
504+
503505
set m $w.backmenu
504506
if {[winfo exists $m]} {
505507
$m delete 0 end
@@ -513,7 +515,7 @@ method _history_menu {} {
513515
set c [lindex $e 0]
514516
set f [lindex $e 1]
515517

516-
if {[regexp {^[0-9a-f]{40}$} $c]} {
518+
if {[regexp [string map "@@ $hashlength" {^[0-9a-f]{@@}$}] $c]} {
517519
set t [string range $c 0 8]...
518520
} elseif {$c eq {}} {
519521
set t {Working Directory}
@@ -627,6 +629,7 @@ method _exec_blame {cur_w cur_d options cur_s} {
627629
method _read_blame {fd cur_w cur_d} {
628630
upvar #0 $cur_d line_data
629631
variable group_colors
632+
global hashlength nullid
630633

631634
if {$fd ne $current_fd} {
632635
catch {close $fd}
@@ -635,7 +638,7 @@ method _read_blame {fd cur_w cur_d} {
635638

636639
$cur_w conf -state normal
637640
while {[gets $fd line] >= 0} {
638-
if {[regexp {^([a-z0-9]{40}) (\d+) (\d+) (\d+)$} $line line \
641+
if {[regexp [string map "@@ $hashlength" {^([a-z0-9]{@@}) (\d+) (\d+) (\d+)$}] $line line \
639642
cmit original_line final_line line_count]} {
640643
set r_commit $cmit
641644
set r_orig_line $original_line
@@ -648,7 +651,7 @@ method _read_blame {fd cur_w cur_d} {
648651
set oln $r_orig_line
649652
set cmit $r_commit
650653

651-
if {[regexp {^0{40}$} $cmit]} {
654+
if {$cmit eq $nullid} {
652655
set commit_abbr work
653656
set commit_type curr_commit
654657
} elseif {$cmit eq $commit} {
@@ -807,9 +810,7 @@ method _read_blame {fd cur_w cur_d} {
807810
# thorough copy search; insert before the threshold
808811
set original_options [linsert $original_options 0 -C]
809812
}
810-
if {[git-version >= 1.5.3]} {
811-
lappend original_options -w ; # ignore indentation changes
812-
}
813+
lappend original_options -w ; # ignore indentation changes
813814

814815
_exec_blame $this $w_amov @amov_data \
815816
$original_options \
@@ -857,9 +858,7 @@ method _fullcopyblame {} {
857858
set threshold [get_config gui.copyblamethreshold]
858859
set original_options [list -C -C "-C$threshold"]
859860

860-
if {[git-version >= 1.5.3]} {
861-
lappend original_options -w ; # ignore indentation changes
862-
}
861+
lappend original_options -w ; # ignore indentation changes
863862

864863
# Find the line range
865864
set pos @$::cursorX,$::cursorY
@@ -1298,7 +1297,7 @@ method _open_tooltip {cur_w} {
12981297
# On MacOS raising a window causes it to acquire focus.
12991298
# Tk 8.5 on MacOS seems to properly support wm transient,
13001299
# so we can safely counter the effect there.
1301-
if {$::have_tk85 && [is_MacOSX]} {
1300+
if {[is_MacOSX]} {
13021301
update
13031302
if {$w eq {}} {
13041303
raise .

git-gui/lib/branch_checkout.tcl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,23 @@ field opt_fetch 1; # refetch tracking branch if used?
1010
field opt_detach 0; # force a detached head case?
1111

1212
constructor dialog {} {
13-
global use_ttk NS
1413
make_dialog top w
1514
wm withdraw $w
1615
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
1716
if {$top ne {.}} {
1817
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
1918
}
2019

21-
${NS}::label $w.header -text [mc "Checkout Branch"] \
20+
ttk::label $w.header -text [mc "Checkout Branch"] \
2221
-font font_uibold -anchor center
2322
pack $w.header -side top -fill x
2423

25-
${NS}::frame $w.buttons
26-
${NS}::button $w.buttons.create -text [mc Checkout] \
24+
ttk::frame $w.buttons
25+
ttk::button $w.buttons.create -text [mc Checkout] \
2726
-default active \
2827
-command [cb _checkout]
2928
pack $w.buttons.create -side right
30-
${NS}::button $w.buttons.cancel -text [mc Cancel] \
29+
ttk::button $w.buttons.cancel -text [mc Cancel] \
3130
-command [list destroy $w]
3231
pack $w.buttons.cancel -side right -padx 5
3332
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -36,14 +35,14 @@ constructor dialog {} {
3635
$w_rev bind_listbox <Double-Button-1> [cb _checkout]
3736
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
3837

39-
${NS}::labelframe $w.options -text [mc Options]
38+
ttk::labelframe $w.options -text [mc Options]
4039

41-
${NS}::checkbutton $w.options.fetch \
40+
ttk::checkbutton $w.options.fetch \
4241
-text [mc "Fetch Tracking Branch"] \
4342
-variable @opt_fetch
4443
pack $w.options.fetch -anchor nw
4544

46-
${NS}::checkbutton $w.options.detach \
45+
ttk::checkbutton $w.options.detach \
4746
-text [mc "Detach From Local Branch"] \
4847
-variable @opt_detach
4948
pack $w.options.detach -anchor nw

git-gui/lib/branch_create.tcl

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ field opt_fetch 1; # refetch tracking branch if used?
1616
field reset_ok 0; # did the user agree to reset?
1717

1818
constructor dialog {} {
19-
global repo_config use_ttk NS
19+
global repo_config
2020

2121
make_dialog top w
2222
wm withdraw $w
@@ -25,39 +25,37 @@ constructor dialog {} {
2525
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
2626
}
2727

28-
${NS}::label $w.header -text [mc "Create New Branch"] \
28+
ttk::label $w.header -text [mc "Create New Branch"] \
2929
-font font_uibold -anchor center
3030
pack $w.header -side top -fill x
3131

32-
${NS}::frame $w.buttons
33-
${NS}::button $w.buttons.create -text [mc Create] \
32+
ttk::frame $w.buttons
33+
ttk::button $w.buttons.create -text [mc Create] \
3434
-default active \
3535
-command [cb _create]
3636
pack $w.buttons.create -side right
37-
${NS}::button $w.buttons.cancel -text [mc Cancel] \
37+
ttk::button $w.buttons.cancel -text [mc Cancel] \
3838
-command [list destroy $w]
3939
pack $w.buttons.cancel -side right -padx 5
4040
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
4141

42-
${NS}::labelframe $w.desc -text [mc "Branch Name"]
43-
${NS}::radiobutton $w.desc.name_r \
42+
ttk::labelframe $w.desc -text [mc "Branch Name"]
43+
ttk::radiobutton $w.desc.name_r \
4444
-text [mc "Name:"] \
4545
-value user \
4646
-variable @name_type
47-
if {!$use_ttk} {$w.desc.name_r configure -anchor w}
4847
set w_name $w.desc.name_t
49-
${NS}::entry $w_name \
48+
ttk::entry $w_name \
5049
-width 40 \
5150
-textvariable @name \
5251
-validate key \
5352
-validatecommand [cb _validate %d %S]
5453
grid $w.desc.name_r $w_name -sticky we -padx {0 5}
5554

56-
${NS}::radiobutton $w.desc.match_r \
55+
ttk::radiobutton $w.desc.match_r \
5756
-text [mc "Match Tracking Branch Name"] \
5857
-value match \
5958
-variable @name_type
60-
if {!$use_ttk} {$w.desc.match_r configure -anchor w}
6159
grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2
6260

6361
grid columnconfigure $w.desc 1 -weight 1
@@ -66,34 +64,34 @@ constructor dialog {} {
6664
set w_rev [::choose_rev::new $w.rev [mc "Starting Revision"]]
6765
pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5
6866

69-
${NS}::labelframe $w.options -text [mc Options]
67+
ttk::labelframe $w.options -text [mc Options]
7068

71-
${NS}::frame $w.options.merge
72-
${NS}::label $w.options.merge.l -text [mc "Update Existing Branch:"]
69+
ttk::frame $w.options.merge
70+
ttk::label $w.options.merge.l -text [mc "Update Existing Branch:"]
7371
pack $w.options.merge.l -side left
74-
${NS}::radiobutton $w.options.merge.no \
72+
ttk::radiobutton $w.options.merge.no \
7573
-text [mc No] \
7674
-value none \
7775
-variable @opt_merge
7876
pack $w.options.merge.no -side left
79-
${NS}::radiobutton $w.options.merge.ff \
77+
ttk::radiobutton $w.options.merge.ff \
8078
-text [mc "Fast Forward Only"] \
8179
-value ff \
8280
-variable @opt_merge
8381
pack $w.options.merge.ff -side left
84-
${NS}::radiobutton $w.options.merge.reset \
82+
ttk::radiobutton $w.options.merge.reset \
8583
-text [mc Reset] \
8684
-value reset \
8785
-variable @opt_merge
8886
pack $w.options.merge.reset -side left
8987
pack $w.options.merge -anchor nw
9088

91-
${NS}::checkbutton $w.options.fetch \
89+
ttk::checkbutton $w.options.fetch \
9290
-text [mc "Fetch Tracking Branch"] \
9391
-variable @opt_fetch
9492
pack $w.options.fetch -anchor nw
9593

96-
${NS}::checkbutton $w.options.checkout \
94+
ttk::checkbutton $w.options.checkout \
9795
-text [mc "Checkout After Creation"] \
9896
-variable @opt_checkout
9997
pack $w.options.checkout -anchor nw

git-gui/lib/branch_delete.tcl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ field w_check ; # revision picker for merge test
99
field w_delete ; # delete button
1010

1111
constructor dialog {} {
12-
global current_branch use_ttk NS
12+
global current_branch
1313

1414
make_dialog top w
1515
wm withdraw $w
@@ -18,25 +18,25 @@ constructor dialog {} {
1818
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
1919
}
2020

21-
${NS}::label $w.header -text [mc "Delete Local Branch"] \
21+
ttk::label $w.header -text [mc "Delete Local Branch"] \
2222
-font font_uibold -anchor center
2323
pack $w.header -side top -fill x
2424

25-
${NS}::frame $w.buttons
25+
ttk::frame $w.buttons
2626
set w_delete $w.buttons.delete
27-
${NS}::button $w_delete \
27+
ttk::button $w_delete \
2828
-text [mc Delete] \
2929
-default active \
3030
-state disabled \
3131
-command [cb _delete]
3232
pack $w_delete -side right
33-
${NS}::button $w.buttons.cancel \
33+
ttk::button $w.buttons.cancel \
3434
-text [mc Cancel] \
3535
-command [list destroy $w]
3636
pack $w.buttons.cancel -side right -padx 5
3737
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
3838

39-
${NS}::labelframe $w.list -text [mc "Local Branches"]
39+
ttk::labelframe $w.list -text [mc "Local Branches"]
4040
set w_heads $w.list.l
4141
slistbox $w_heads \
4242
-height 10 \

0 commit comments

Comments
 (0)