git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitk: new option to hide prefetch refs
@ 2021-08-24 12:18 Tal Kelrich via GitGitGadget
  2021-08-24 13:49 ` Derrick Stolee
  2024-03-05 19:45 ` [PATCH v3] " Tal Kelrich
  0 siblings, 2 replies; 5+ messages in thread
From: Tal Kelrich via GitGitGadget @ 2021-08-24 12:18 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras, Tal Kelrich, Tal Kelrich

From: Tal Kelrich <hasturkun@gmail.com>

The maintenance 'prefetch' task creates refs that mirror remote refs,
and in repositories with many branches this can clutter the commit list.

Add a new option to ignore any prefetch refs, enabled by default.

Signed-off-by: Tal Kelrich <hasturkun@gmail.com>
---
    gitk: new option to hide prefetch refs
    
    Adding a new option for gitk to ignore prefetch refs, as these clutter
    the commit list on repositories with many branches.
    
    This defaults to being enabled, as I would expect users usually wouldn't
    want to see these.
    
    It might have been better to allow gitk to read log.excludeDecoration
    (or a gitk specific configured pattern) and use that to ignore refs, but
    this was simpler for me to implement without knowing Tcl.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1023%2Fhasturkun%2Fgitk-ignore-prefetch-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1023/hasturkun/gitk-ignore-prefetch-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1023

 gitk-git/gitk | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 23d9dd1fe0d..4e44da517f2 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1780,6 +1780,7 @@ proc readrefs {} {
     global selecthead selectheadid
     global hideremotes
     global tclencoding
+    global hideprefetch
 
     foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
         unset -nocomplain $v
@@ -1814,6 +1815,7 @@ proc readrefs {} {
             }
             set tagids($name) $id
             lappend idtags($id) $name
+        } elseif {[string match "prefetch/*" $name] && $hideprefetch} {
         } else {
             set otherrefids($name) $id
             lappend idotherrefs($id) $name
@@ -11548,7 +11550,7 @@ proc create_prefs_page {w} {
 proc prefspage_general {notebook} {
     global NS maxwidth maxgraphpct showneartags showlocalchanges
     global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
-    global hideremotes want_ttk have_ttk maxrefs web_browser
+    global hideremotes want_ttk have_ttk maxrefs web_browser hideprefetch
 
     set page [create_prefs_page $notebook.general]
 
@@ -11572,6 +11574,9 @@ proc prefspage_general {notebook} {
     ${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \
         -variable hideremotes
     grid x $page.hideremotes -sticky w
+    ${NS}::checkbutton $page.hideprefetch -text [mc "Hide prefetch refs"] \
+        -variable hideprefetch
+    grid x $page.hideprefetch -sticky w
 
     ${NS}::label $page.ddisp -text [mc "Diff display options"]
     grid $page.ddisp - -sticky w -pady 10
@@ -11696,7 +11701,7 @@ proc doprefs {} {
     global oldprefs prefstop showneartags showlocalchanges
     global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
     global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
-    global hideremotes want_ttk have_ttk
+    global hideremotes want_ttk have_ttk hideprefetch
 
     set top .gitkprefs
     set prefstop $top
@@ -11705,7 +11710,8 @@ proc doprefs {} {
         return
     }
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-                   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+                   limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+                   hideprefetch} {
         set oldprefs($v) [set $v]
     }
     ttk_toplevel $top
@@ -11831,7 +11837,8 @@ proc prefscan {} {
     global oldprefs prefstop
 
     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
-                   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+                   limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+                   hideprefetch} {
         global $v
         set $v $oldprefs($v)
     }
@@ -11845,7 +11852,7 @@ proc prefsok {} {
     global oldprefs prefstop showneartags showlocalchanges
     global fontpref mainfont textfont uifont
     global limitdiffs treediffs perfile_attrs
-    global hideremotes
+    global hideremotes hideprefetch
 
     catch {destroy $prefstop}
     unset prefstop
@@ -11891,7 +11898,8 @@ proc prefsok {} {
           $limitdiffs != $oldprefs(limitdiffs)} {
         reselectline
     }
-    if {$hideremotes != $oldprefs(hideremotes)} {
+    if {$hideremotes != $oldprefs(hideremotes) ||
+          $hideprefetch != $oldprefs(hideprefetch)} {
         rereadrefs
     }
 }
@@ -12365,6 +12373,7 @@ set cmitmode "patch"
 set wrapcomment "none"
 set showneartags 1
 set hideremotes 0
+set hideprefetch 1
 set maxrefs 20
 set visiblerefs {"master"}
 set maxlinelen 200
@@ -12477,7 +12486,7 @@ set config_variables {
     filesepbgcolor filesepfgcolor linehoverbgcolor linehoverfgcolor
     linehoveroutlinecolor mainheadcirclecolor workingfilescirclecolor
     indexcirclecolor circlecolors linkfgcolor circleoutlinecolor diffbgcolors
-    web_browser
+    web_browser hideprefetch
 }
 foreach var $config_variables {
     config_init_trace $var

base-commit: 225bc32a989d7a22fa6addafd4ce7dcd04675dbf
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-05 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 12:18 [PATCH] gitk: new option to hide prefetch refs Tal Kelrich via GitGitGadget
2021-08-24 13:49 ` Derrick Stolee
2021-08-24 18:46   ` Junio C Hamano
2021-08-24 21:47     ` Derrick Stolee
2024-03-05 19:45 ` [PATCH v3] " Tal Kelrich

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).