如何显示更多最近的存储库'在Git GUI?

时间:2013-07-10 11:26:38

标签: git git-gui

我的Git-GUI副本在“打开最近的存储库”列表下显示了10个条目。如何将其更改为例如20?目前,每当我打开第11个回购时,列表中按字母顺序排列的最后一个消失 - 当列表已满并且我在回购Zed和Alpha之间交替{不是他们的真名!}

我没有很好地阅读TCL,但我认为相关的行是#267,在C:/ Program Files(x86)/Git/share/git-gui/lib/choose_repository.tcl中。我尝试以管理员身份打开我最喜欢的编辑器,将该行更改为“> 20”,重新启动Git-GUI,然后打开另一个存储库,但这没有帮助 - 底部条目再次从列表中删除。当我重新打开choose_repository.tcl时,我的编辑仍然存在,所以它肯定会被保存。

while {[llength $recent] > 10} {

我该怎么办?

正在使用的软件:

  • Windows 7
  • git-gui version 0.17.GITGUI
  • git version 1.8.3.msysgit.0
  • TCl / TK版本8.5.13
  • git-gui lib:C:/ Program Files(x86)/ Git / share / git-gui / lib

1 个答案:

答案 0 :(得分:3)

你快到了。你找到了让git-gui记录超过10个以前打开的存储库的地方。但是,用于显示存储库列表的文本小部件只有10行高 - 所以如果你在第151行也改变它,你将同时记录并查看它们。

这是一个补丁,可以让你设置gui.maxrecentrepo并将最近的最大存储库数量固定为这个值(默认为10):

diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index 657f7d5..c8d8517 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -24,6 +24,10 @@ field sorted_recent       ; # recent repositories (sorted)
 constructor pick {} {
        global M1T M1B use_ttk NS

+       if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
+               set maxrecent 10
+       }
+
        make_dialog top w
        wm title $top [mc "Git Gui"]

@@ -148,7 +152,7 @@ constructor pick {} {
                        -background [get_bg_color $w_body.recentlabel] \
                        -wrap none \
                        -width 50 \
-                       -height 10
+                       -height $maxrecent
                $w_recentlist tag conf link \
                        -foreground blue \
                        -underline 1
@@ -264,7 +268,11 @@ proc _append_recentrepos {path} {
        git config --global --add gui.recentrepo $path
        load_config 1

-       while {[llength $recent] > 10} {
+       if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
+               set maxrecent 10
+       }
+
+       while {[llength $recent] > $maxrecent} {
                _unset_recentrepo [lindex $recent 0]
                set recent [lrange $recent 1 end]
        }
相关问题