Hi all.  I'm wondering if anyone has any thoughts about the best, or
even any, way to have "branch properties": some extra information which
is attached to a branch (that is, the actual branch name not the commit
it currently points to).

My requirements are that the information needs to be pushed to the
server, so that lets out branch descriptions for example.  Ideally the
information would also be easily updated and available in all clones
during normal fetch operations but this isn't a hard requirement: I
could script it.

My immediate desire is to find a way to mark a branch as "frozen", that
will control which pushes are allowed.  I use gitolite on my server and
I can easily write a server hook that will handle the checking,
rejecting, etc.  I already have such an infrastructure.  What I need is
a way to know which branches are in that state, so my hook can see that
and DTRT.  There are other "branch properties" I could envision, too,
but don't have a real need right now.

Of course I could embed the frozen state into the gitolite repository
configuration.  Indeed, I have already implemented "locks" for obsolete
branches.  But "frozen" is a more ephemeral state and requiring access
to the gitolite repository to manage it is just not what I want; it's a
separate repository so the state is not visible, requires privileges I
really don't want to hand out to everyone, and is generally difficult. 
I want some users to be able to manage frozen branches relatively
easily, and all users to be able to see the state of which branches are
frozen, etc.

So then I thought about creating a "frozen" tag, like "frozen/v1.0" or
something.  This is slightly weird because it is applied to a commit,
which is not really right, but whatever: it's just a marker so I would
just be checking to see if it exists or not.  The other problem is that
Git tags are not intended to be transient/moveable.  While you CAN
delete them and move them, when someone pulls the repository they won't
get that update by default.  Since the hook is server-side the fact
that the local repository has the wrong information doesn't matter for
behavior, but it's confusing for people.  So, it's not ideal.

I thought about creating a branch, like "frozen/v1.0", rather than a
tag.  I don't need a branch here, and no one would push to that branch
(I'd have to disallow that in my hooks), and the commit associated with
the branch would not be relevant most likely.  I would only check to
see if the branch existed, or not.  Branches are nice because creating
and deleting them is handled automatically (if you use prune
consistently, which we do because we have tons of transient branches).

Then I looked into using notes, and they look interesting, but they're
associated with a specific commit as well and I don't want that: a
frozen branch can still have new commits pushed to it they just have
meet certain criteria.  This makes them hard to translate into a branch

So far, using a special branch name seems the most "reasonable".  But,
I wonder if I missed some cool aspect if Git that would work better, or
if anyone else has other suggestions.


Reply via email to