Skip to content

Commit

Permalink
Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui
Browse files Browse the repository at this point in the history
git-gui 0.21.0

* tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui: (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.
  ...
  • Loading branch information
gitster committed Oct 20, 2016
2 parents 6598894 + ccc9851 commit 3eae308
Show file tree
Hide file tree
Showing 26 changed files with 2,337 additions and 2,278 deletions.
2 changes: 1 addition & 1 deletion git-gui/GIT-VERSION-GEN
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

GVF=GIT-VERSION-FILE
DEF_VER=0.20.GITGUI
DEF_VER=0.21.GITGUI

LF='
'
Expand Down
2 changes: 1 addition & 1 deletion git-gui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
rm -f $@ ; \
echo '# Autogenerated by git-gui Makefile' >$@ && \
echo >>$@ && \
$(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
$(foreach p,$(PRELOAD_FILES) $(sort $(ALL_LIBFILES)),echo '$(subst lib/,,$p)' >>$@ &&) \
echo >>$@ ; \
fi

Expand Down
154 changes: 85 additions & 69 deletions git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ proc is_Cygwin {} {
set _iscygwin 0
} else {
set _iscygwin 1
# Handle MSys2 which is only cygwin when MSYSTEM is MSYS.
if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} {
set _iscygwin 0
}
}
} else {
set _iscygwin 0
Expand Down Expand Up @@ -530,28 +534,10 @@ proc _lappend_nice {cmd_var} {
}
proc git {args} {
set opt [list]
while {1} {
switch -- [lindex $args 0] {
--nice {
_lappend_nice opt
}
default {
break
}
}
set args [lrange $args 1 end]
}
set cmdp [_git_cmd [lindex $args 0]]
set args [lrange $args 1 end]
_trace_exec [concat $opt $cmdp $args]
set result [eval exec $opt $cmdp $args]
set fd [eval [list git_read] $args]
fconfigure $fd -translation binary -encoding utf-8
set result [string trimright [read $fd] "\n"]
close $fd
if {$::_trace} {
puts stderr "< $result"
}
Expand Down Expand Up @@ -1107,7 +1093,7 @@ git-version proc _parse_config {arr_name args} {
[list git_read config] \
$args \
[list --null --list]]
fconfigure $fd_rc -translation binary
fconfigure $fd_rc -translation binary -encoding utf-8
set buf [read $fd_rc]
close $fd_rc
}
Expand Down Expand Up @@ -1616,11 +1602,13 @@ proc run_prepare_commit_msg_hook {} {
if {[file isfile [gitdir MERGE_MSG]]} {
set pcm_source "merge"
set fd_mm [open [gitdir MERGE_MSG] r]
fconfigure $fd_mm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_mm]
close $fd_mm
} elseif {[file isfile [gitdir SQUASH_MSG]]} {
set pcm_source "squash"
set fd_sm [open [gitdir SQUASH_MSG] r]
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} else {
Expand Down Expand Up @@ -1685,7 +1673,7 @@ proc read_diff_index {fd after} {
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom $p] \
[encoding convertfrom utf-8 $p] \
[lindex $i 4]? \
[list [lindex $i 0] [lindex $i 2]] \
[list]
Expand Down Expand Up @@ -1718,7 +1706,7 @@ proc read_diff_files {fd after} {
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom $p] \
[encoding convertfrom utf-8 $p] \
?[lindex $i 4] \
[list] \
[list [lindex $i 0] [lindex $i 2]]
Expand All @@ -1741,7 +1729,7 @@ proc read_ls_others {fd after} {
set pck [split $buf_rlo "\0"]
set buf_rlo [lindex $pck end]
foreach p [lrange $pck 0 end-1] {
set p [encoding convertfrom $p]
set p [encoding convertfrom utf-8 $p]
if {[string index $p end] eq {/}} {
set p [string range $p 0 end-1]
}
Expand Down Expand Up @@ -2505,20 +2493,36 @@ proc force_first_diff {after} {
}
}
proc toggle_or_diff {w x y} {
proc toggle_or_diff {mode w args} {
global file_states file_lists current_diff_path ui_index ui_workdir
global last_clicked selected_paths
set pos [split [$w index @$x,$y] .]
set lno [lindex $pos 0]
set col [lindex $pos 1]
if {$mode eq "click"} {
foreach {x y} $args break
set pos [split [$w index @$x,$y] .]
foreach {lno col} $pos break
} else {
if {$last_clicked ne {}} {
set lno [lindex $last_clicked 1]
} else {
set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
}
if {$mode eq "toggle"} {
set col 0; set y 2
} else {
incr lno [expr {$mode eq "up" ? -1 : 1}]
set col 1
}
}
set path [lindex $file_lists($w) [expr {$lno - 1}]]
if {$path eq {}} {
set last_clicked {}
return
}
set last_clicked [list $w $lno]
focus $w
array unset selected_paths
$ui_index tag remove in_sel 0.0 end
$ui_workdir tag remove in_sel 0.0 end
Expand Down Expand Up @@ -2598,7 +2602,7 @@ proc add_range_to_selection {w x y} {
global file_lists last_clicked selected_paths
if {[lindex $last_clicked 0] ne $w} {
toggle_or_diff $w $x $y
toggle_or_diff click $w $x $y
return
}
Expand Down Expand Up @@ -3007,7 +3011,7 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
set subcommand_args {}
proc usage {} {
set s "usage: $::argv0 $::subcommand $::subcommand_args"
set s "[mc usage:] $::argv0 $::subcommand $::subcommand_args"
if {[tk windowingsystem] eq "win32"} {
wm withdraw .
tk_messageBox -icon info -message $s \
Expand Down Expand Up @@ -3139,7 +3143,7 @@ gui {
# fall through to setup UI for commits
}
default {
set err "usage: $argv0 \[{blame|browser|citool}\]"
set err "[mc usage:] $argv0 \[{blame|browser|citool}\]"
if {[tk windowingsystem] eq "win32"} {
wm withdraw .
tk_messageBox -icon error -message $err \
Expand Down Expand Up @@ -3178,16 +3182,38 @@ if {$use_ttk} {
}
pack .vpane -anchor n -side top -fill both -expand 1
# -- Working Directory File List
textframe .vpane.files.workdir -height 100 -width 200
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -foreground black
ttext $ui_workdir -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-takefocus 1 -highlightthickness 1\
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.workdir.sx set} \
-yscrollcommand {.vpane.files.workdir.sy set} \
-state disabled
${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
pack .vpane.files.workdir.title -side top -fill x
pack .vpane.files.workdir.sx -side bottom -fill x
pack .vpane.files.workdir.sy -side right -fill y
pack $ui_workdir -side left -fill both -expand 1
# -- Index File List
#
${NS}::frame .vpane.files.index -height 100 -width 200
textframe .vpane.files.index -height 100 -width 200
tlabel .vpane.files.index.title \
-text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -foreground black
text $ui_index -background white -foreground black \
ttext $ui_index -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-takefocus 1 -highlightthickness 1\
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.index.sx set} \
-yscrollcommand {.vpane.files.index.sy set} \
Expand All @@ -3199,26 +3225,8 @@ pack .vpane.files.index.sx -side bottom -fill x
pack .vpane.files.index.sy -side right -fill y
pack $ui_index -side left -fill both -expand 1
# -- Working Directory File List
# -- Insert the workdir and index into the panes
#
${NS}::frame .vpane.files.workdir -height 100 -width 200
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -foreground black
text $ui_workdir -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.workdir.sx set} \
-yscrollcommand {.vpane.files.workdir.sy set} \
-state disabled
${NS}::scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview]
${NS}::scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview]
pack .vpane.files.workdir.title -side top -fill x
pack .vpane.files.workdir.sx -side bottom -fill x
pack .vpane.files.workdir.sy -side right -fill y
pack $ui_workdir -side left -fill both -expand 1
.vpane.files add .vpane.files.workdir
.vpane.files add .vpane.files.index
if {!$use_ttk} {
Expand Down Expand Up @@ -3301,7 +3309,7 @@ if {![is_enabled nocommit]} {
#
${NS}::frame .vpane.lower.commarea.buffer
${NS}::frame .vpane.lower.commarea.buffer.header
set ui_comm .vpane.lower.commarea.buffer.t
set ui_comm .vpane.lower.commarea.buffer.frame.t
set ui_coml .vpane.lower.commarea.buffer.header.l
if {![is_enabled nocommit]} {
Expand Down Expand Up @@ -3344,20 +3352,25 @@ if {![is_enabled nocommit]} {
pack .vpane.lower.commarea.buffer.header.new -side right
}
text $ui_comm -background white -foreground black \
textframe .vpane.lower.commarea.buffer.frame
ttext $ui_comm -background white -foreground black \
-borderwidth 1 \
-undo true \
-maxundo 20 \
-autoseparators true \
-takefocus 1 \
-highlightthickness 1 \
-relief sunken \
-width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
-font font_diff \
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
${NS}::scrollbar .vpane.lower.commarea.buffer.sby \
-yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set}
${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
-command [list $ui_comm yview]
pack .vpane.lower.commarea.buffer.header -side top -fill x
pack .vpane.lower.commarea.buffer.sby -side right -fill y
pack .vpane.lower.commarea.buffer.frame.sby -side right -fill y
pack $ui_comm -side left -fill y
pack .vpane.lower.commarea.buffer.header -side top -fill x
pack .vpane.lower.commarea.buffer.frame -side left -fill y
pack .vpane.lower.commarea.buffer -side left -fill y
# -- Commit Message Buffer Context Menu
Expand Down Expand Up @@ -3455,12 +3468,13 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
# -- Diff Body
#
${NS}::frame .vpane.lower.diff.body
textframe .vpane.lower.diff.body
set ui_diff .vpane.lower.diff.body.t
text $ui_diff -background white -foreground black \
ttext $ui_diff -background white -foreground black \
-borderwidth 0 \
-width 80 -height 5 -wrap none \
-font font_diff \
-takefocus 1 -highlightthickness 1 \
-xscrollcommand {.vpane.lower.diff.body.sbx set} \
-yscrollcommand {.vpane.lower.diff.body.sby set} \
-state disabled
Expand Down Expand Up @@ -3815,10 +3829,10 @@ bind . <$M1B-Key-r> ui_do_rescan
bind . <$M1B-Key-R> ui_do_rescan
bind . <$M1B-Key-s> do_signoff
bind . <$M1B-Key-S> do_signoff
bind . <$M1B-Key-t> do_add_selection
bind . <$M1B-Key-T> do_add_selection
bind . <$M1B-Key-u> do_unstage_selection
bind . <$M1B-Key-U> do_unstage_selection
bind . <$M1B-Key-t> { toggle_or_diff toggle %W }
bind . <$M1B-Key-T> { toggle_or_diff toggle %W }
bind . <$M1B-Key-u> { toggle_or_diff toggle %W }
bind . <$M1B-Key-U> { toggle_or_diff toggle %W }
bind . <$M1B-Key-j> do_revert_selection
bind . <$M1B-Key-J> do_revert_selection
bind . <$M1B-Key-i> do_add_all
Expand All @@ -3830,9 +3844,11 @@ bind . <$M1B-Key-plus> {show_more_context;break}
bind . <$M1B-Key-KP_Add> {show_more_context;break}
bind . <$M1B-Key-Return> do_commit
foreach i [list $ui_index $ui_workdir] {
bind $i <Button-1> "toggle_or_diff $i %x %y; break"
bind $i <$M1B-Button-1> "add_one_to_selection $i %x %y; break"
bind $i <Shift-Button-1> "add_range_to_selection $i %x %y; break"
bind $i <Button-1> { toggle_or_diff click %W %x %y; break }
bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break }
bind $i <Shift-Button-1> { add_range_to_selection %W %x %y; break }
bind $i <Key-Up> { toggle_or_diff up %W; break }
bind $i <Key-Down> { toggle_or_diff down %W; break }
}
unset i
Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/blame.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} {
set path $i_path

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

set font_w [font measure font_diff "0"]

Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/branch_checkout.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ constructor dialog {} {
global use_ttk NS
make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/branch_create.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ constructor dialog {} {

make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
Expand Down
4 changes: 2 additions & 2 deletions git-gui/lib/branch_delete.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ constructor dialog {} {

make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
Expand Down Expand Up @@ -128,7 +128,7 @@ method _delete {} {
set b [lindex $i 0]
set o [lindex $i 1]
if {[catch {git branch -D $b} err]} {
append failed " - $b: $err\n"
append failed [mc " - %s:" $b] " $err\n"
}
}

Expand Down
2 changes: 1 addition & 1 deletion git-gui/lib/branch_rename.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ constructor dialog {} {

make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
Expand Down
Loading

0 comments on commit 3eae308

Please sign in to comment.