From 2c1b06dff9a2b953c3692bacca6eeaa78d33fd01 Mon Sep 17 00:00:00 2001 From: Philip Oakley Date: Mon, 14 Dec 2015 10:37:02 +0000 Subject: git-gui: remove duplicate entries from .gitconfig's gui.recentrepo The git gui's recent repo list may become contaminated with duplicate entries. The git gui would barf when attempting to remove one entry. Remove them all - there is no option within 'git config' to selectively remove one of the entries. This issue was reported on the 'Git User' list (https://groups.google.com/forum/#!topic/git-users/msev4KsQGFc, Warning: gui.recentrepo has multiply values while executing). And also by zosrothko as a Git-for-Windows issue https://github.com/git-for-windows/git/issues/1014. On startup the gui checks that entries in the recentrepo list are still valid repos and deletes thoses that are not. If duplicate entries are present the 'git config --unset' will barf and this prevents the gui from starting. Subsequent patches fix other parts of recentrepo logic used for syncing internal lists with the external .gitconfig. Reported-by: Alexey Astakhov Signed-off-by: Philip Oakley diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 75d1da8..133ca0a 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -247,7 +247,7 @@ proc _get_recentrepos {} { proc _unset_recentrepo {p} { regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p - git config --global --unset gui.recentrepo "^$p\$" + git config --global --unset-all gui.recentrepo "^$p\$" load_config 1 } -- cgit v0.10.2-6-g49f6 From 3202c68ee0060d3a1f3b6f73b4932c6e8b263abb Mon Sep 17 00:00:00 2001 From: Philip Oakley Date: Mon, 14 Dec 2015 11:19:32 +0000 Subject: 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 diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index 133ca0a..aa87bcc 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -235,14 +235,14 @@ method _invoke_next {} { proc _get_recentrepos {} { set recent [list] - foreach p [get_config gui.recentrepo] { + foreach p [lsort -unique [get_config gui.recentrepo]] { if {[_is_git [file join $p .git]]} { lappend recent $p } else { _unset_recentrepo $p } } - return [lsort $recent] + return $recent } proc _unset_recentrepo {p} { -- cgit v0.10.2-6-g49f6 From e670fce17f79f6305f17f2a91732565909c678dd Mon Sep 17 00:00:00 2001 From: Philip Oakley Date: Mon, 14 Dec 2015 10:42:04 +0000 Subject: git gui: de-dup selected repo from recentrepo history When the gui/user selects a repo for display, that repo is brought to the end of the recentrepo config list. The logic can fail if there are duplicate old entries for the repo (you cannot unset a single config entry when duplicates are present). Similarly, the maxrecentrepo logic could fail if older duplicate entries are present. The first commit of this series ({this}~2) fixed the config unsetting issue. Rather than manipulating a local copy of the $recent list (one cannot know how many entries were removed), simply re-read it. We must also catch the error when the attempt to remove the second copy from the re-read list is performed. Signed-off-by: Philip Oakley diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index aa87bcc..f39636f 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -247,7 +247,7 @@ proc _get_recentrepos {} { proc _unset_recentrepo {p} { regsub -all -- {([()\[\]{}\.^$+*?\\])} $p {\\\1} p - git config --global --unset-all gui.recentrepo "^$p\$" + catch {git config --global --unset-all gui.recentrepo "^$p\$"} load_config 1 } @@ -262,12 +262,11 @@ proc _append_recentrepos {path} { set i [lsearch $recent $path] if {$i >= 0} { _unset_recentrepo $path - set recent [lreplace $recent $i $i] } - lappend recent $path git config --global --add gui.recentrepo $path load_config 1 + set recent [get_config gui.recentrepo] if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} { set maxrecent 10 @@ -275,7 +274,7 @@ proc _append_recentrepos {path} { while {[llength $recent] > $maxrecent} { _unset_recentrepo [lindex $recent 0] - set recent [lrange $recent 1 end] + set recent [get_config gui.recentrepo] } } -- cgit v0.10.2-6-g49f6 From 746df946f30a32945117049b9419d586193e54e0 Mon Sep 17 00:00:00 2001 From: Philip Oakley Date: Mon, 14 Dec 2015 12:56:40 +0000 Subject: git gui: allow for a long recentrepo list The gui.recentrepo list may be longer than the maxrecent setting. Allow extra space to show any extra entries. In an ideal world, the git gui would limit the number of entries to the maxrecent setting, however the recentrepo config list may have been extended outwith the gui, or the maxrecent setting changed to a reduced value. Further, when testing the gui's recentrepo logic it is useful to show these extra, but valid, entries. Signed-off-by: Philip Oakley diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index f39636f..80f5a59 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -142,6 +142,10 @@ constructor pick {} { -label [mc "Recent Repositories"] } + if {[set lenrecent [llength $sorted_recent]] < $maxrecent} { + set lenrecent $maxrecent + } + ${NS}::label $w_body.space ${NS}::label $w_body.recentlabel \ -anchor w \ @@ -153,7 +157,7 @@ constructor pick {} { -background [get_bg_color $w_body.recentlabel] \ -wrap none \ -width 50 \ - -height $maxrecent + -height $lenrecent $w_recentlist tag conf link \ -foreground blue \ -underline 1 -- cgit v0.10.2-6-g49f6 From 492595cfc70f97cd99d4c460db1ba01b73dab932 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 25 Jul 2017 10:35:57 +0200 Subject: git-gui (MinGW): make use of MSys2's msgfmt When Git for Windows was still based on MSys1, we had no gettext, ergo no msgfmt, either. Therefore, we introduced a small and simple Tcl script to perform the same task. However, with MSys2, we no longer need that because we have a proper msgfmt executable. Plus, the po2msg.sh script somehow manages to hang when run in parallel in Git for Windows' SDK (symptom: the Continuous Testing tasks timing out). Two reasons to use real msgfmt.exe instead. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index fe30be3..918a8de 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,9 @@ ifeq ($(uname_S),Darwin) endif endif ifneq (,$(findstring MINGW,$(uname_S))) +ifeq ($(shell expr "$(uname_R)" : '1\.'),2) NO_MSGFMT=1 +endif GITGUI_WINDOWS_WRAPPER := YesPlease GITGUI_RELATIVE := 1 endif -- cgit v0.10.2-6-g49f6