git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Archiving tags/branches?

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 21, 2008, 08:15 UTC
Message-ID
<200810211015.27257.jnareb@gmail.com>
In-Reply-To
<48FD55BF.1020207@pcharlan.com>
On Tue, 21 Oct 2008 06:08, Pete Harlan napisał:
> Jakub Narebski wrote:
>> Pete Harlan <pgit@pcharlan.com> writes:
>>> Johan Herland wrote:
Show 33 quoted lines
>>>
>>> Using a secondary repo solely to overcome a flat tag/branch namespace
>>> feels hackish.  Perhaps git will benefit someday from work in this area,
>>> but until I come up with a patch your suggestion should work fine.  Just
>>> knowing I didn't overlook an existing feature helps a lot.
>> 
>> I don't quite understand what you mean by _flat_ namespace for tags
>> and branches.
>> 
>> First, it is not unusual to have hierarchical branch names, at least
>> for short-term topic branches. For example in git.git history (and in
>> "What's cooking..." announcements on git mailing list) you can find
>> branch names such as rs/alloc-ref, nd/narrow, tr/workflow-doc.
>> Additionally remote-tracking branch names have inherently hierarchical
>> names: refs/remotes/<remote>/<remote branch>.  While tag names usually
>> are of the type x.y.z, it is not mandated by some technological
>> limitation.
> 
> What I mean by "flat" is that "/" is just another character as far as
> what git exposes to the user.  Regardless of any semantics the user
> chooses to assign to it, and regardless of what advantage git makes use
> of "/" internally, unless I can do something like:
> 
> % git tag --ls
> sometag
> someothertag
> releases/
> % git tag --ls releases/
> releases/2008/
> releases/2007/
> % git tag --ls releases/2008
> releases/2008/r3.14
> %

Actually you can have kind of second and third examples; "git tag -l" takes optional <pattern> argument, so you can do the folowing without any new features:

  # git tag -l 'releases/2008/*'
  releases/2008/r3.14
 
(the quotes are to protect wildcard characters against expansion by
shell)
Show 7 quoted lines
> "/" is just like any another character in a tag or branch.
> 
> (The above notional --ls modifier is probably very easy to write, and if
> I do so it may address all of my woes.  Subversion's branching/tagging
> can be organized pretty much exactly like this, and importing into git
> such a repository is what initially led me to ask about organizing tags
> and branches.)
Hmmm... it looks like what you are complaining is not the fact that
tags have flat namespace, but the fact that recursive mode is the
default behavior (something like "ls -R" or "git ls-tree -r").
 
Show 6 quoted lines
> What I'm usually likely to want from a "list tags" command is to see the
> most recent few tags, not (say) all 226 tags in git.git.  I'll probably
> write a little alias that does that, but even then when looking at the
> whole list it would be nice to have the option to navigate it
> hierarchically.  (Or in some other manner, and/or possibly with a
> configurable directory separator.)

So you would want some '--local' / '--non-recursive' option to listing all tags (for git-tag) and branches (for git-branch).

As to the "most recent few tags":
  $ git for-each-ref --format='%(refname)' --sort=-taggerdate --count=10 refs/tags/
-- 
Jakub Narebski
Poland
Previous: Pete HarlanNext: Pete Harlan
Message 13 of 14 in “Archiving tags/branches?”
  1. Pete HarlanOct 18, 2008
  2. David SymondsOct 18, 2008
  3. Pete HarlanOct 20, 2008
  4. SZEDER GáborOct 18, 2008
  5. Johan HerlandOct 18, 2008
  6. SZEDER GáborOct 18, 2008
  7. Johan HerlandOct 18, 2008
  8. Pete HarlanOct 20, 2008
  9. Johan HerlandOct 20, 2008
  10. Pete HarlanOct 21, 2008
  11. Jakub NarebskiOct 20, 2008
  12. Pete HarlanOct 21, 2008
  13. Jakub NarebskiOct 21, 2008
  14. Pete HarlanOct 21, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.