ansible / proposals

Repository for sharing and tracking progress on enhancement proposals for Ansible.
Creative Commons Zero v1.0 Universal
93 stars 19 forks source link

Allow people to use master as an alias for devel in git #43

Closed abadger closed 7 years ago

abadger commented 7 years ago

Proposal: Allow people to use master as an alias for devel in git

Date: 2016/12/12

Motivation

Many git projects use master to mean their default trunk branch. Ansible uses devel for historical reasons. This confuses other users

Solution proposal

So the solution proposed is to run:

git symbolic-ref -m "Add compatibility for people used to a default master branch" master refs/heads/devel

Testing (optional)

Make a new local copy of the repository and then run git symbolic-ref -m "Add compatibility for people used to a default master branch" master refs/heads/devel

Then test:

mscherer commented 7 years ago

I am +1 on that, that's already what I do, but I didn't realise this could be done on the repo directly.

dagwieers commented 7 years ago

@abadger I did some more research, and learned that while this is "technically" possible, Git does not allow to push symbolic references. GitHub does allow to update the HEAD symbolic reference (by means of changing the default branch) but has no means of adding other symbolic references.

Once set though, others can pull them (like normal branches etc.) so the limitation here is GitHub (or the Git protocol if you like).

http://git.661346.n2.nabble.com/Pushing-symbolic-references-to-remote-repositories-td7573536.html http://stackoverflow.com/questions/847609/create-a-git-symbolic-ref-in-remote-repository

For GitLab there is a feature-request to allow for this:

https://gitlab.com/gitlab-org/gitlab-ce/issues/20370

bcoca commented 7 years ago

So will that make PRs harder? if someone pushes one to /master but we need to merge it into /devel ?

dagwieers commented 7 years ago

@bcoca How it is now working on my system, if you checkout master, it is devel for git.

[dag@moria ansible.dag]$ git checkout master
Switched to branch 'master'
[dag@moria ansible.dag]$ git status
# On branch devel
nothing to commit (working directory clean)

What I did for this was actually:

[dag@moria ansible.dag]$ git symbolic-ref -m "Add compatibility for people used to a default master branch" refs/heads/master refs/heads/devel

And for Git

[dag@moria ansible.dag]$ git show-ref --heads -d master devel
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c refs/heads/devel
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c refs/heads/master
[dag@moria ansible.dag]$ tail .git/refs/heads/{devel,master}
==> .git/refs/heads/devel <==
4b9a65fd7c443716553a2d04b2e80a73b4b76e8c

==> .git/refs/heads/master <==
ref: refs/heads/devel

So while it looks as if both branches simply reference the same commit, in practice one points to the other as if it were the same branch.

dagwieers commented 7 years ago

And to proof that this works in Git itself, that's how the default branch is being selected:

[dag@moria ansible.dag]$ cat .git/refs/remotes/origin/HEAD 
ref: refs/remotes/origin/devel
bcoca commented 7 years ago

nice, if it is transparent i have no opposition

I don't get the 'difficulty' of not having a 'master', but if people really want it....

dminca commented 7 years ago

haha and when I suggested this on IRC someone yelled at me if that's how you use it, doesn't mean we have to use it too lol

dagwieers commented 7 years ago

@dminca I think it is important to use (or abide) to standard practices, where possible. I would prefer the default branch is called master, but if there is a solution that allows both, why not do that. Unfortunately it seems GitHub at this time does not allow us to do this through their Web-interface. However, maybe there is another way to do this on GitHub, I don't know yet.

https://www.spinics.net/lists/git/msg195321.html

alikins commented 7 years ago

Some notes from irc core meeting 2016-12-15

<bcoca> the only issue i see with that is the initial reasons we had for not issuing a master/ ... so 
people would not consider it stable
<bcoca> that is why we have stable branches and push primarily against /devel
<bcoca> i persontally dont care either way
<agaffney> people already clone the git repo and pay no attention to the branch name and then complain
 that things are broken
<ryansb> If it wouldn't change our process, I don't see a benefit
<alikins> Seems reasonable to me. I guess https://github.com/ansible/proposals/issues/43#issuecomment-267122340 is kind of an issue  (if we can
 do this for the github repo)
<bcoca> people will be confused by this no matter what we do ... also if this is biggest issue we have left
 in ansible ... i would be joyful
<nitzmahone> Curious how the alias would interact with GH protected branches if we need to lock things
 down...
<agaffney> I can understand *why* this was requested, but I think it would probably be more trouble than
 its worth
* nitzmahone would tend to agree
<ryansb> it would just be *more* confusing because then we'd need to keep both in sync etc
<bcoca> if github interactions are not clear, we should defer any decisions until we know
<bcoca> cannot decide w/o knowing full consequences ... its not like im POTUS
<agaffney> needs more twitter rants
<bcoca> agaffney: as author, object or bystander?
* allanice001 votes for master == stable
<alikins> main utility to me is to make random git tools that assume 'master' work by default. Also no
 master is kind of a unnecessary unexpected behavior without much utility aside being status quo.
<bcoca> im fine if it does not affect current workflow, but we cannot make a decision when we don't know
 the consequences on the github side, i would defer this to next meeting and have someone investigate
 the interatcions
<nitzmahone> Master as current stable would likely cause even more problems, since we rarely want
 direct commits to stable.
<alikins> #info https://github.com/ansible/proposals/issues/43#issuecomment-267122340  
Unclear if github supports the branch alias
<bcoca> so any discussion now is not that useful until we KNOW
<alikins> #info <nitzmahone> Curious how the alias would interact with GH protected branches if we need
 to lock things down...
<alikins> #action Figure out if this works on github.  dag, bcoca, abadger1999 
<alikins> I'd say that topic is covered for now.
<alikins> Next topic?
dminca commented 7 years ago

I couldn't agree more @dagwieers, since git was designed, the master branch was used by many as continuous trunk of development. When you want to release, you branch off for that release.

gundalow commented 7 years ago

This still needs doing:

#action Figure out if this works on github. dag, bcoca, abadger1999
gundalow commented 7 years ago

Also we need to know what the real benefits are

gundalow commented 7 years ago

Jimi-C said no

Closing