Re: Git "branch properties"-- thoughts?
>But for a generic branch like 'master', that arrangement would not >work well, I am afraid. You may have N copies of the same project, >where the 'master' branch of each is used to work on separate topic. >The focus of the 'master' branch of the overall project would be >quite different from each of these copies you have, hence it is >likely that it would be inappropriate to share the task list and >stuff you would want to add to branch descriptions and branch >properties between the shared repository's 'master' and any of your >'master' in these N copies you have. > >So... I think it could work in a way that other people branch properties are only taken into account if you don't have your own properties of those same names already set. In that case, git would initialize your branch properties from the other branch of the same name and inform you about it. Of course, you should always have a way to overwrite any property to a value of your choice. So what you would be getting from others were basically default values (inspired by https://docs.python.org/3.5/library/stdtypes.html#dict.setdefault). Would it work? This sounds pretty good to me. I would really love to have a chance to implement this feature if people were interested in it. clime
Re: Git "branch properties"-- thoughts?
Phillip Woodwrites: > It would certainly be nice to be able to share branch descriptions so > that if I clone a repository I can get a bit more detail about the ideas > behind each branch. Shared descriptions could be displayed in web uis. I One thing to note is that there is no universal identity for branches across repositoryes that push and pull from each other. My 'refs/heads/master' may be copied to your 'refs/remotes/origin/master' so in that sense, any "branch property" I give to my 'master' branch (including the 'branch.master.description') could be copied to its corresponding "remote-tracking branch property" you have, but that is the easy part. It is quite hard to figure out how these branch properties you acquired from me on my branches affect properties of _your_ own branches that build on top of the branches you obtained from me. Perhaps a narrow special case of two or more people collaborating on a single topic branch with the same focus would be helped by blindly sharing the "branch property" across the local and remote-tracking branches that share the same name. I.e. the shared repository may have 'optimize-frotz' topic branch, you and your friend both copy to your 'refs/remotes/origin/optimize-frotz' remote-tracking branch, and these copies will share the same "branch properties" copied from the shared repository. Then if you and your friend both work on the topic by "git checkout -b optimize-frotz origin/optimize-frotz", perhaps your and your friend's optmize-frotz branch would inherit the same "branch properties" copied from their upstream. Because all of the participants are focused on a rather narrow task of "optimizing the frotz feature" on their branches that share the same name, pretending as if these are "logically" the same branch, and enforcing that by sharing the "branch properties", may make sense. But for a generic branch like 'master', that arrangement would not work well, I am afraid. You may have N copies of the same project, where the 'master' branch of each is used to work on separate topic. The focus of the 'master' branch of the overall project would be quite different from each of these copies you have, hence it is likely that it would be inappropriate to share the task list and stuff you would want to add to branch descriptions and branch properties between the shared repository's 'master' and any of your 'master' in these N copies you have. So...
Re: Git "branch properties"-- thoughts?
On 22/02/18 18:29, Paul Smith wrote: > > 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 > name. > > 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. > > Cheers! > Hi Paul It would certainly be nice to be able to share branch descriptions so that if I clone a repository I can get a bit more detail about the ideas behind each branch. Shared descriptions could be displayed in web uis. I sometimes find myself wanting something like notes for branches as well to make a todo list for future commits. Maybe there could be a well known refs (say refs/metadata) that contains public metadata for other refs. In the same way that refs/notes/commits contains a tree of commit ids refs/metadata would contain ref paths without the leaning ref/. Under than directory there would be a subtree with the metadata - files called description, frozen, a directory of notes etc. So for refs/heads/master you'd have refs/metadata/heads/description containing the description refs/metadata/heads/master/notes/... containing the notes I want to share and refs/heads/metadata/master/frozen to indicate if the branch was frozen. Best Wishes Phillip
Git "branch properties"-- thoughts?
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 name. 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. Cheers!