Git development
 help / color / mirror / Atom feed
From: Jan Harkes <jaharkes@cs.cmu.edu>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: Problems with binary patches (pull) and spaces in filenames (gitk)
Date: Wed, 9 Nov 2005 18:00:48 -0500	[thread overview]
Message-ID: <20051109230048.GH31850@delft.aura.cs.cmu.edu> (raw)
In-Reply-To: <7vfyq5bhi2.fsf@assigned-by-dhcp.cox.net>

On Wed, Nov 09, 2005 at 02:09:41PM -0800, Junio C Hamano wrote:
> Another minor gitk gripe I have is that it does not look at
> subdirectories of refs/{heads,tags}/ so I do not get labels to
> my topic branch heads.

I've been using the following gitk 'customization'. ISTR that it can be
cleaned up a bit further and do everything in a single scan of the refs/
subtree. I'll take another look at that tonight.

Jan

diff --git a/gitk b/gitk
index a9d37d9..cd0b84f 100755
--- a/gitk
+++ b/gitk
@@ -237,16 +237,27 @@ proc parsecommit {id contents listed old
 			     $comname $comdate $comment]
 }
 
+# recursively list all files in a directory
+proc listTree {root} {
+    set files [glob -nocomplain -directory $root -types f *]
+    set nodes [glob -nocomplain -directory $root -types d *]
+    foreach node $nodes {
+	set children [listTree $node]
+	set files [concat $files $children]
+    }
+    return $files
+}
+
 proc readrefs {} {
     global tagids idtags headids idheads tagcontents
 
-    set tags [glob -nocomplain -types f [gitdir]/refs/tags/*]
+    set tags [listTree [gitdir]/refs/tags]
     foreach f $tags {
 	catch {
 	    set fd [open $f r]
 	    set line [read $fd]
 	    if {[regexp {^[0-9a-f]{40}} $line id]} {
-		set direct [file tail $f]
+		regexp {[gitdir]/refs/tags/(.*)} $f match direct
 		set tagids($direct) $id
 		lappend idtags($id) $direct
 		set tagblob [exec git-cat-file tag $id]
@@ -271,13 +282,13 @@ proc readrefs {} {
 	    close $fd
 	}
     }
-    set heads [glob -nocomplain -types f [gitdir]/refs/heads/*]
+    set heads [listTree [gitdir]/refs/heads]
     foreach f $heads {
 	catch {
 	    set fd [open $f r]
 	    set line [read $fd 40]
 	    if {[regexp {^[0-9a-f]{40}} $line id]} {
-		set head [file tail $f]
+		regexp {[gitdir]/refs/heads/(.*)} $f match head
 		set headids($head) $line
 		lappend idheads($line) $head
 	    }

  parent reply	other threads:[~2005-11-09 23:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 21:37 Problems with binary patches (pull) and spaces in filenames (gitk) Peter Eriksen
2005-11-09 22:09 ` Junio C Hamano
2005-11-09 22:36   ` Junio C Hamano
2005-11-09 23:33     ` Peter Eriksen
2005-11-09 23:00   ` Jan Harkes [this message]
2005-11-09 22:10 ` Linus Torvalds

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=20051109230048.GH31850@delft.aura.cs.cmu.edu \
    --to=jaharkes@cs.cmu.edu \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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