Skip to content

Commit 46d58a0

Browse files
committed
Merge branch 'pt/gitgui-updates'
A new version of git-gui, now at its 0.21.0 tag. * pt/gitgui-updates: (22 commits) git-gui: set version 0.21 git-gui: Mark 'All' in remote.tcl for translation git-gui i18n: Updated Bulgarian translation (565,0f,0u) git-gui: avoid persisting modified author identity git-gui: handle the encoding of Git's output correctly git-gui: unicode file name support on windows git-gui: Update Russian translation git-gui: maintain backwards compatibility for merge syntax git-gui i18n: mark string in lib/error.tcl for translation git-gui: fix incorrect use of Tcl append command git-gui i18n: mark "usage:" strings for translation git-gui i18n: internationalize use of colon punctuation git-gui: ensure the file in the diff pane is in the list of selected files git-gui: support for $FILENAMES in tool definitions git-gui: fix initial git gui message encoding git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut` git-gui: fix detection of Cygwin Amend tab ordering and text widget border and highlighting. Allow keyboard control to work in the staging widgets. ...
2 parents d347fb6 + 3eae308 commit 46d58a0

26 files changed

+2337
-2278
lines changed

git-gui/GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=0.20.GITGUI
4+
DEF_VER=0.21.GITGUI
55

66
LF='
77
'

git-gui/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
259259
rm -f $@ ; \
260260
echo '# Autogenerated by git-gui Makefile' >$@ && \
261261
echo >>$@ && \
262-
$(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
262+
$(foreach p,$(PRELOAD_FILES) $(sort $(ALL_LIBFILES)),echo '$(subst lib/,,$p)' >>$@ &&) \
263263
echo >>$@ ; \
264264
fi
265265

git-gui/git-gui.sh

Lines changed: 85 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ proc is_Cygwin {} {
275275
set _iscygwin 0
276276
} else {
277277
set _iscygwin 1
278+
# Handle MSys2 which is only cygwin when MSYSTEM is MSYS.
279+
if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} {
280+
set _iscygwin 0
281+
}
278282
}
279283
} else {
280284
set _iscygwin 0
@@ -530,28 +534,10 @@ proc _lappend_nice {cmd_var} {
530534
}
531535
532536
proc git {args} {
533-
set opt [list]
534-
535-
while {1} {
536-
switch -- [lindex $args 0] {
537-
--nice {
538-
_lappend_nice opt
539-
}
540-
541-
default {
542-
break
543-
}
544-
545-
}
546-
547-
set args [lrange $args 1 end]
548-
}
549-
550-
set cmdp [_git_cmd [lindex $args 0]]
551-
set args [lrange $args 1 end]
552-
553-
_trace_exec [concat $opt $cmdp $args]
554-
set result [eval exec $opt $cmdp $args]
537+
set fd [eval [list git_read] $args]
538+
fconfigure $fd -translation binary -encoding utf-8
539+
set result [string trimright [read $fd] "\n"]
540+
close $fd
555541
if {$::_trace} {
556542
puts stderr "< $result"
557543
}
@@ -1107,7 +1093,7 @@ git-version proc _parse_config {arr_name args} {
11071093
[list git_read config] \
11081094
$args \
11091095
[list --null --list]]
1110-
fconfigure $fd_rc -translation binary
1096+
fconfigure $fd_rc -translation binary -encoding utf-8
11111097
set buf [read $fd_rc]
11121098
close $fd_rc
11131099
}
@@ -1616,11 +1602,13 @@ proc run_prepare_commit_msg_hook {} {
16161602
if {[file isfile [gitdir MERGE_MSG]]} {
16171603
set pcm_source "merge"
16181604
set fd_mm [open [gitdir MERGE_MSG] r]
1605+
fconfigure $fd_mm -encoding utf-8
16191606
puts -nonewline $fd_pcm [read $fd_mm]
16201607
close $fd_mm
16211608
} elseif {[file isfile [gitdir SQUASH_MSG]]} {
16221609
set pcm_source "squash"
16231610
set fd_sm [open [gitdir SQUASH_MSG] r]
1611+
fconfigure $fd_sm -encoding utf-8
16241612
puts -nonewline $fd_pcm [read $fd_sm]
16251613
close $fd_sm
16261614
} else {
@@ -1685,7 +1673,7 @@ proc read_diff_index {fd after} {
16851673
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
16861674
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
16871675
merge_state \
1688-
[encoding convertfrom $p] \
1676+
[encoding convertfrom utf-8 $p] \
16891677
[lindex $i 4]? \
16901678
[list [lindex $i 0] [lindex $i 2]] \
16911679
[list]
@@ -1718,7 +1706,7 @@ proc read_diff_files {fd after} {
17181706
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
17191707
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
17201708
merge_state \
1721-
[encoding convertfrom $p] \
1709+
[encoding convertfrom utf-8 $p] \
17221710
?[lindex $i 4] \
17231711
[list] \
17241712
[list [lindex $i 0] [lindex $i 2]]
@@ -1741,7 +1729,7 @@ proc read_ls_others {fd after} {
17411729
set pck [split $buf_rlo "\0"]
17421730
set buf_rlo [lindex $pck end]
17431731
foreach p [lrange $pck 0 end-1] {
1744-
set p [encoding convertfrom $p]
1732+
set p [encoding convertfrom utf-8 $p]
17451733
if {[string index $p end] eq {/}} {
17461734
set p [string range $p 0 end-1]
17471735
}
@@ -2505,20 +2493,36 @@ proc force_first_diff {after} {
25052493
}
25062494
}
25072495
2508-
proc toggle_or_diff {w x y} {
2496+
proc toggle_or_diff {mode w args} {
25092497
global file_states file_lists current_diff_path ui_index ui_workdir
25102498
global last_clicked selected_paths
25112499
2512-
set pos [split [$w index @$x,$y] .]
2513-
set lno [lindex $pos 0]
2514-
set col [lindex $pos 1]
2500+
if {$mode eq "click"} {
2501+
foreach {x y} $args break
2502+
set pos [split [$w index @$x,$y] .]
2503+
foreach {lno col} $pos break
2504+
} else {
2505+
if {$last_clicked ne {}} {
2506+
set lno [lindex $last_clicked 1]
2507+
} else {
2508+
set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
2509+
}
2510+
if {$mode eq "toggle"} {
2511+
set col 0; set y 2
2512+
} else {
2513+
incr lno [expr {$mode eq "up" ? -1 : 1}]
2514+
set col 1
2515+
}
2516+
}
2517+
25152518
set path [lindex $file_lists($w) [expr {$lno - 1}]]
25162519
if {$path eq {}} {
25172520
set last_clicked {}
25182521
return
25192522
}
25202523
25212524
set last_clicked [list $w $lno]
2525+
focus $w
25222526
array unset selected_paths
25232527
$ui_index tag remove in_sel 0.0 end
25242528
$ui_workdir tag remove in_sel 0.0 end
@@ -2598,7 +2602,7 @@ proc add_range_to_selection {w x y} {
25982602
global file_lists last_clicked selected_paths
25992603
26002604
if {[lindex $last_clicked 0] ne $w} {
2601-
toggle_or_diff $w $x $y
2605+
toggle_or_diff click $w $x $y
26022606
return
26032607
}
26042608
@@ -3007,7 +3011,7 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
30073011
30083012
set subcommand_args {}
30093013
proc usage {} {
3010-
set s "usage: $::argv0 $::subcommand $::subcommand_args"
3014+
set s "[mc usage:] $::argv0 $::subcommand $::subcommand_args"
30113015
if {[tk windowingsystem] eq "win32"} {
30123016
wm withdraw .
30133017
tk_messageBox -icon info -message $s \
@@ -3139,7 +3143,7 @@ gui {
31393143
# fall through to setup UI for commits
31403144
}
31413145
default {
3142-
set err "usage: $argv0 \[{blame|browser|citool}\]"
3146+
set err "[mc usage:] $argv0 \[{blame|browser|citool}\]"
31433147
if {[tk windowingsystem] eq "win32"} {
31443148
wm withdraw .
31453149
tk_messageBox -icon error -message $err \
@@ -3178,16 +3182,38 @@ if {$use_ttk} {
31783182
}
31793183
pack .vpane -anchor n -side top -fill both -expand 1
31803184
3185+
# -- Working Directory File List
3186+
3187+
textframe .vpane.files.workdir -height 100 -width 200
3188+
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
3189+
-background lightsalmon -foreground black
3190+
ttext $ui_workdir -background white -foreground black \
3191+
-borderwidth 0 \
3192+
-width 20 -height 10 \
3193+
-wrap none \
3194+
-takefocus 1 -highlightthickness 1\
3195+
-cursor $cursor_ptr \
3196+
-xscrollcommand {.vpane.files.workdir.sx set} \
3197+
-yscrollcommand {.vpane.files.workdir.sy set} \
3198+
-state disabled
3199+
${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
3200+
${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
3201+
pack .vpane.files.workdir.title -side top -fill x
3202+
pack .vpane.files.workdir.sx -side bottom -fill x
3203+
pack .vpane.files.workdir.sy -side right -fill y
3204+
pack $ui_workdir -side left -fill both -expand 1
3205+
31813206
# -- Index File List
31823207
#
3183-
${NS}::frame .vpane.files.index -height 100 -width 200
3208+
textframe .vpane.files.index -height 100 -width 200
31843209
tlabel .vpane.files.index.title \
31853210
-text [mc "Staged Changes (Will Commit)"] \
31863211
-background lightgreen -foreground black
3187-
text $ui_index -background white -foreground black \
3212+
ttext $ui_index -background white -foreground black \
31883213
-borderwidth 0 \
31893214
-width 20 -height 10 \
31903215
-wrap none \
3216+
-takefocus 1 -highlightthickness 1\
31913217
-cursor $cursor_ptr \
31923218
-xscrollcommand {.vpane.files.index.sx set} \
31933219
-yscrollcommand {.vpane.files.index.sy set} \
@@ -3199,26 +3225,8 @@ pack .vpane.files.index.sx -side bottom -fill x
31993225
pack .vpane.files.index.sy -side right -fill y
32003226
pack $ui_index -side left -fill both -expand 1
32013227
3202-
# -- Working Directory File List
3228+
# -- Insert the workdir and index into the panes
32033229
#
3204-
${NS}::frame .vpane.files.workdir -height 100 -width 200
3205-
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
3206-
-background lightsalmon -foreground black
3207-
text $ui_workdir -background white -foreground black \
3208-
-borderwidth 0 \
3209-
-width 20 -height 10 \
3210-
-wrap none \
3211-
-cursor $cursor_ptr \
3212-
-xscrollcommand {.vpane.files.workdir.sx set} \
3213-
-yscrollcommand {.vpane.files.workdir.sy set} \
3214-
-state disabled
3215-
${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
3216-
${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
3217-
pack .vpane.files.workdir.title -side top -fill x
3218-
pack .vpane.files.workdir.sx -side bottom -fill x
3219-
pack .vpane.files.workdir.sy -side right -fill y
3220-
pack $ui_workdir -side left -fill both -expand 1
3221-
32223230
.vpane.files add .vpane.files.workdir
32233231
.vpane.files add .vpane.files.index
32243232
if {!$use_ttk} {
@@ -3301,7 +3309,7 @@ if {![is_enabled nocommit]} {
33013309
#
33023310
${NS}::frame .vpane.lower.commarea.buffer
33033311
${NS}::frame .vpane.lower.commarea.buffer.header
3304-
set ui_comm .vpane.lower.commarea.buffer.t
3312+
set ui_comm .vpane.lower.commarea.buffer.frame.t
33053313
set ui_coml .vpane.lower.commarea.buffer.header.l
33063314
33073315
if {![is_enabled nocommit]} {
@@ -3344,20 +3352,25 @@ if {![is_enabled nocommit]} {
33443352
pack .vpane.lower.commarea.buffer.header.new -side right
33453353
}
33463354
3347-
text $ui_comm -background white -foreground black \
3355+
textframe .vpane.lower.commarea.buffer.frame
3356+
ttext $ui_comm -background white -foreground black \
33483357
-borderwidth 1 \
33493358
-undo true \
33503359
-maxundo 20 \
33513360
-autoseparators true \
3361+
-takefocus 1 \
3362+
-highlightthickness 1 \
33523363
-relief sunken \
33533364
-width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
33543365
-font font_diff \
3355-
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
3356-
${NS}::scrollbar .vpane.lower.commarea.buffer.sby \
3366+
-yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set}
3367+
${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
33573368
-command [list $ui_comm yview]
3358-
pack .vpane.lower.commarea.buffer.header -side top -fill x
3359-
pack .vpane.lower.commarea.buffer.sby -side right -fill y
3369+
3370+
pack .vpane.lower.commarea.buffer.frame.sby -side right -fill y
33603371
pack $ui_comm -side left -fill y
3372+
pack .vpane.lower.commarea.buffer.header -side top -fill x
3373+
pack .vpane.lower.commarea.buffer.frame -side left -fill y
33613374
pack .vpane.lower.commarea.buffer -side left -fill y
33623375
33633376
# -- Commit Message Buffer Context Menu
@@ -3455,12 +3468,13 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
34553468
34563469
# -- Diff Body
34573470
#
3458-
${NS}::frame .vpane.lower.diff.body
3471+
textframe .vpane.lower.diff.body
34593472
set ui_diff .vpane.lower.diff.body.t
3460-
text $ui_diff -background white -foreground black \
3473+
ttext $ui_diff -background white -foreground black \
34613474
-borderwidth 0 \
34623475
-width 80 -height 5 -wrap none \
34633476
-font font_diff \
3477+
-takefocus 1 -highlightthickness 1 \
34643478
-xscrollcommand {.vpane.lower.diff.body.sbx set} \
34653479
-yscrollcommand {.vpane.lower.diff.body.sby set} \
34663480
-state disabled
@@ -3815,10 +3829,10 @@ bind . <$M1B-Key-r> ui_do_rescan
38153829
bind . <$M1B-Key-R> ui_do_rescan
38163830
bind . <$M1B-Key-s> do_signoff
38173831
bind . <$M1B-Key-S> do_signoff
3818-
bind . <$M1B-Key-t> do_add_selection
3819-
bind . <$M1B-Key-T> do_add_selection
3820-
bind . <$M1B-Key-u> do_unstage_selection
3821-
bind . <$M1B-Key-U> do_unstage_selection
3832+
bind . <$M1B-Key-t> { toggle_or_diff toggle %W }
3833+
bind . <$M1B-Key-T> { toggle_or_diff toggle %W }
3834+
bind . <$M1B-Key-u> { toggle_or_diff toggle %W }
3835+
bind . <$M1B-Key-U> { toggle_or_diff toggle %W }
38223836
bind . <$M1B-Key-j> do_revert_selection
38233837
bind . <$M1B-Key-J> do_revert_selection
38243838
bind . <$M1B-Key-i> do_add_all
@@ -3830,9 +3844,11 @@ bind . <$M1B-Key-plus> {show_more_context;break}
38303844
bind . <$M1B-Key-KP_Add> {show_more_context;break}
38313845
bind . <$M1B-Key-Return> do_commit
38323846
foreach i [list $ui_index $ui_workdir] {
3833-
bind $i <Button-1> "toggle_or_diff $i %x %y; break"
3834-
bind $i <$M1B-Button-1> "add_one_to_selection $i %x %y; break"
3835-
bind $i <Shift-Button-1> "add_range_to_selection $i %x %y; break"
3847+
bind $i <Button-1> { toggle_or_diff click %W %x %y; break }
3848+
bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break }
3849+
bind $i <Shift-Button-1> { add_range_to_selection %W %x %y; break }
3850+
bind $i <Key-Up> { toggle_or_diff up %W; break }
3851+
bind $i <Key-Down> { toggle_or_diff down %W; break }
38363852
}
38373853
unset i
38383854

git-gui/lib/blame.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} {
7070
set path $i_path
7171

7272
make_toplevel top w
73-
wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
73+
wm title $top [mc "%s (%s): File Viewer" [appname] [reponame]]
7474

7575
set font_w [font measure font_diff "0"]
7676

git-gui/lib/branch_checkout.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ constructor dialog {} {
1313
global use_ttk NS
1414
make_dialog top w
1515
wm withdraw $w
16-
wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
16+
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
1717
if {$top ne {.}} {
1818
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
1919
}

git-gui/lib/branch_create.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ constructor dialog {} {
2020

2121
make_dialog top w
2222
wm withdraw $w
23-
wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
23+
wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]]
2424
if {$top ne {.}} {
2525
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
2626
}

git-gui/lib/branch_delete.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ constructor dialog {} {
1313

1414
make_dialog top w
1515
wm withdraw $w
16-
wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
16+
wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]]
1717
if {$top ne {.}} {
1818
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
1919
}
@@ -128,7 +128,7 @@ method _delete {} {
128128
set b [lindex $i 0]
129129
set o [lindex $i 1]
130130
if {[catch {git branch -D $b} err]} {
131-
append failed " - $b: $err\n"
131+
append failed [mc " - %s:" $b] " $err\n"
132132
}
133133
}
134134

git-gui/lib/branch_rename.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ constructor dialog {} {
1212

1313
make_dialog top w
1414
wm withdraw $w
15-
wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
15+
wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]]
1616
if {$top ne {.}} {
1717
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
1818
}

0 commit comments

Comments
 (0)