Merge branch 'js/msgfmt-on-windows' of ../git-gui into js/git-gui-msgfmt-on-windows

* 'js/msgfmt-on-windows' of ../git-gui:
  git-gui (MinGW): make use of MSys2's msgfmt
  git gui: allow for a long recentrepo list
  git gui: de-dup selected repo from recentrepo history
  git gui: cope with duplicates in _get_recentrepo
  git-gui: remove duplicate entries from .gitconfig's gui.recentrepo
This commit is contained in:
Junio C Hamano 2017-07-25 13:42:41 -07:00
Родитель 5800c63717 492595cfc7
Коммит 90dbf226ba
2 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -161,7 +161,9 @@ ifeq ($(uname_S),Darwin)
endif endif
endif endif
ifneq (,$(findstring MINGW,$(uname_S))) ifneq (,$(findstring MINGW,$(uname_S)))
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
NO_MSGFMT=1 NO_MSGFMT=1
endif
GITGUI_WINDOWS_WRAPPER := YesPlease GITGUI_WINDOWS_WRAPPER := YesPlease
GITGUI_RELATIVE := 1 GITGUI_RELATIVE := 1
endif endif

Просмотреть файл

@ -142,6 +142,10 @@ constructor pick {} {
-label [mc "Recent Repositories"] -label [mc "Recent Repositories"]
} }
if {[set lenrecent [llength $sorted_recent]] < $maxrecent} {
set lenrecent $maxrecent
}
${NS}::label $w_body.space ${NS}::label $w_body.space
${NS}::label $w_body.recentlabel \ ${NS}::label $w_body.recentlabel \
-anchor w \ -anchor w \
@ -153,7 +157,7 @@ constructor pick {} {
-background [get_bg_color $w_body.recentlabel] \ -background [get_bg_color $w_body.recentlabel] \
-wrap none \ -wrap none \
-width 50 \ -width 50 \
-height $maxrecent -height $lenrecent
$w_recentlist tag conf link \ $w_recentlist tag conf link \
-foreground blue \ -foreground blue \
-underline 1 -underline 1
@ -235,19 +239,19 @@ method _invoke_next {} {
proc _get_recentrepos {} { proc _get_recentrepos {} {
set recent [list] set recent [list]
foreach p [get_config gui.recentrepo] { foreach p [lsort -unique [get_config gui.recentrepo]] {
if {[_is_git [file join $p .git]]} { if {[_is_git [file join $p .git]]} {
lappend recent $p lappend recent $p
} else { } else {
_unset_recentrepo $p _unset_recentrepo $p
} }
} }
return [lsort $recent] return $recent
} }
proc _unset_recentrepo {p} { proc _unset_recentrepo {p} {
regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p
git config --global --unset gui.recentrepo "^$p\$" catch {git config --global --unset-all gui.recentrepo "^$p\$"}
load_config 1 load_config 1
} }
@ -262,12 +266,11 @@ proc _append_recentrepos {path} {
set i [lsearch $recent $path] set i [lsearch $recent $path]
if {$i >= 0} { if {$i >= 0} {
_unset_recentrepo $path _unset_recentrepo $path
set recent [lreplace $recent $i $i]
} }
lappend recent $path
git config --global --add gui.recentrepo $path git config --global --add gui.recentrepo $path
load_config 1 load_config 1
set recent [get_config gui.recentrepo]
if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} { if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
set maxrecent 10 set maxrecent 10
@ -275,7 +278,7 @@ proc _append_recentrepos {path} {
while {[llength $recent] > $maxrecent} { while {[llength $recent] > $maxrecent} {
_unset_recentrepo [lindex $recent 0] _unset_recentrepo [lindex $recent 0]
set recent [lrange $recent 1 end] set recent [get_config gui.recentrepo]
} }
} }