From: Michael Rappazzo <rappazzo@gmail.com>
To: git@vger.kernel.org
Cc: paulus@samba.org, Michael Rappazzo <rappazzo@gmail.com>
Subject: [PATCH] gitk: Alter the ordering for the "Tags and heads" view
Date: Tue, 2 Jun 2015 07:11:10 -0400 [thread overview]
Message-ID: <1433243470-93392-2-git-send-email-rappazzo@gmail.com> (raw)
In-Reply-To: <1433243470-93392-1-git-send-email-rappazzo@gmail.com>
In the "Tags and heads" view, the list of refs is globally sorted.
The list of local refs (heads) is separated by the remote refs. This
change re-orders the view toi be: local refs, remote refs tracked by
local refs, remote refs, tags, and then other refs
Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
---
gitk-git/gitk | 48 ++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 6 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 9a2daf3..431a6a1 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -9879,35 +9879,71 @@ proc refill_reflist {} {
global curview
if {![info exists showrefstop] || ![winfo exists $showrefstop]} return
- set refs {}
+ set localrefs {}
+ set remoterefs {}
+ set locally_tracked_remote_refs {}
+ set tagrefs {}
+ set otherrefs {}
foreach n [array names headids] {
- if {[string match $reflistfilter $n]} {
+ if {![string match "remotes/*" $n] && [string match $reflistfilter $n]} {
+ if {[commitinview $headids($n) $curview]} {
+ lappend localrefs [list $n H]
+ catch {set remote_name [exec git config --get branch.$n.remote]}
+ if {$remote_name ne ""} {
+ catch {set remote_ref [exec git config --get branch.$n.merge]}
+ set remote_ref [string map {"refs/heads/" ""} $remote_ref]
+ set locally_tracked_remote_ref "remotes/$remote_name/$remote_ref"
+ catch {set exists [exec git rev-parse --verify $locally_tracked_remote_ref]}
+ if {$exists ne ""} {
+ if {[lsearch $locally_tracked_remote_refs [list $locally_tracked_remote_ref H]] < 0} {
+ lappend locally_tracked_remote_refs [list $locally_tracked_remote_ref H]
+ }
+ }
+ set exists ""
+ }
+ } else {
+ interestedin $headids($n) {run refill_reflist}
+ }
+ }
+ }
+ set locally_tracked_remote_refs [lsort -index 0 $locally_tracked_remote_refs]
+ set localrefs [lsort -index 0 $localrefs]
+
+ foreach n [array names headids] {
+ if {[string match "remotes/*" $n] && [string match $reflistfilter $n]} {
if {[commitinview $headids($n) $curview]} {
- lappend refs [list $n H]
+ if {[lsearch $locally_tracked_remote_refs [list $n H]] < 0} {
+ lappend remoterefs [list $n H]
+ }
} else {
interestedin $headids($n) {run refill_reflist}
}
}
}
+ set remoterefs [lsort -index 0 $remoterefs]
+
foreach n [array names tagids] {
if {[string match $reflistfilter $n]} {
if {[commitinview $tagids($n) $curview]} {
- lappend refs [list $n T]
+ lappend tagrefs [list $n T]
} else {
interestedin $tagids($n) {run refill_reflist}
}
}
}
+ set tagrefs [lsort -index 0 $tagrefs]
+
foreach n [array names otherrefids] {
if {[string match $reflistfilter $n]} {
if {[commitinview $otherrefids($n) $curview]} {
- lappend refs [list $n o]
+ lappend otherrefs [list "$n" o]
} else {
interestedin $otherrefids($n) {run refill_reflist}
}
}
}
- set refs [lsort -index 0 $refs]
+ set otherrefs [lsort -index 0 $otherrefs]
+ lappend refs {*}$localrefs {*}$locally_tracked_remote_refs {*}$remoterefs {*}$tagrefs {*}$otherrefs
if {$refs eq $reflist} return
# Update the contents of $showrefstop.list according to the
--
2.4.2
next prev parent reply other threads:[~2015-06-02 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 11:11 [PATCH] gitk: Alter the ordering for the "Tags and heads" view Michael Rappazzo
2015-06-02 11:11 ` Michael Rappazzo [this message]
2015-08-13 0:43 ` Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433243470-93392-2-git-send-email-rappazzo@gmail.com \
--to=rappazzo@gmail.com \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).