Skip to content

Commit 40dc8d3

Browse files
committed
Merge branch 'js/git-gui-msgfmt-on-windows'
Because recent Git for Windows do come with a real msgfmt, the build procedure for git-gui has been updated to use it instead of a hand-rolled substitute. * js/git-gui-msgfmt-on-windows: 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
2 parents 6d2b8a3 + 90dbf22 commit 40dc8d3

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

git-gui/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ ifeq ($(uname_S),Darwin)
161161
endif
162162
endif
163163
ifneq (,$(findstring MINGW,$(uname_S)))
164+
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
164165
NO_MSGFMT=1
166+
endif
165167
GITGUI_WINDOWS_WRAPPER := YesPlease
166168
GITGUI_RELATIVE := 1
167169
endif

git-gui/lib/choose_repository.tcl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ constructor pick {} {
142142
-label [mc "Recent Repositories"]
143143
}
144144

145+
if {[set lenrecent [llength $sorted_recent]] < $maxrecent} {
146+
set lenrecent $maxrecent
147+
}
148+
145149
${NS}::label $w_body.space
146150
${NS}::label $w_body.recentlabel \
147151
-anchor w \
@@ -153,7 +157,7 @@ constructor pick {} {
153157
-background [get_bg_color $w_body.recentlabel] \
154158
-wrap none \
155159
-width 50 \
156-
-height $maxrecent
160+
-height $lenrecent
157161
$w_recentlist tag conf link \
158162
-foreground blue \
159163
-underline 1
@@ -235,19 +239,19 @@ method _invoke_next {} {
235239

236240
proc _get_recentrepos {} {
237241
set recent [list]
238-
foreach p [get_config gui.recentrepo] {
242+
foreach p [lsort -unique [get_config gui.recentrepo]] {
239243
if {[_is_git [file join $p .git]]} {
240244
lappend recent $p
241245
} else {
242246
_unset_recentrepo $p
243247
}
244248
}
245-
return [lsort $recent]
249+
return $recent
246250
}
247251

248252
proc _unset_recentrepo {p} {
249253
regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p
250-
git config --global --unset gui.recentrepo "^$p\$"
254+
catch {git config --global --unset-all gui.recentrepo "^$p\$"}
251255
load_config 1
252256
}
253257

@@ -262,20 +266,19 @@ proc _append_recentrepos {path} {
262266
set i [lsearch $recent $path]
263267
if {$i >= 0} {
264268
_unset_recentrepo $path
265-
set recent [lreplace $recent $i $i]
266269
}
267270

268-
lappend recent $path
269271
git config --global --add gui.recentrepo $path
270272
load_config 1
273+
set recent [get_config gui.recentrepo]
271274

272275
if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
273276
set maxrecent 10
274277
}
275278

276279
while {[llength $recent] > $maxrecent} {
277280
_unset_recentrepo [lindex $recent 0]
278-
set recent [lrange $recent 1 end]
281+
set recent [get_config gui.recentrepo]
279282
}
280283
}
281284

0 commit comments

Comments
 (0)