git gui: cope with duplicates in _get_recentrepo
_get_recentrepo will fail if duplicate invalid entries are present in the recentrepo config list. The previous commit fixed the 'git config' limitations in _unset_recentrepo by unsetting all config entries, however this code would fail on the second attempt to unset it. Refactor the code to pre-sort and de-duplicate the recentrepo list to avoid a potential second unset attempt. Signed-off-by: Philip Oakley <philipoakley@iee.org>
Philip Oakley committed
Dec 14, 2015 at 11:19 UTC
3202c68ee0060d3a1f3b6f73b4932c6e8b263abb
1 file changed
+2
-2
lib/choose_repository.tcl
+2
-2
@@ -235,14 +235,14 @@ method _invoke_next {} {
235
236
proc _get_recentrepos {} {
237
set recent [list]
238
- foreach p [get_config gui.recentrepo] {
238
+ foreach p [lsort -unique [get_config gui.recentrepo]] {
239
if {[_is_git [file join $p .git]]} {
240
lappend recent $p
241
} else {
242
_unset_recentrepo $p
243
}
244
}
245
- return [lsort $recent]
245
+ return $recent
246
}
247
248
proc _unset_recentrepo {p} {