Use main as default branch name
Hi Philip,
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
It might be easier to manage for _us_, the Git developers. But every user who initializes a repository and wants to push now needs to take the extra step to give their unnamed branch ("detached HEAD" is _still_ confusing new users!!!) a name.
That would be much more disruptive than choosing a "rather dull and boring" name instead of a rather racially-charged one.
And we promised to try to minimize the disruption to Git users.
Ciao,
Dscho
Hi Dscho,
Quoted 11 lines · Johannes Schindelin
Hi Philip,
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
It might be easier to manage for _us_, the Git developers. But every user who initializes a repository and wants to push now
Is this 'emerges fully formed' initialise & push really that common.
I'd be expecting a few add & commits prior to the push, so plenty of time for deciding and creating the chosen branch. At least that was the thought process...
Quoted 5 lines
needs to take the extra
step to give their unnamed branch("detached HEAD" is _still_ confusing
new users!!!) a name.
I'd only mentioned the detached head to keep the devs happy ;-) I'm quite happy with a "not on any named branch yet" type message for normal usage.
Quoted 3 lines
That would be much more disruptive than choosing a "rather dull and boring" name instead of a rather racially-charged one.
"Main" is fine, but Junio had mention say "Primary" as being more positive, but that is begging the question for the user. We should let them chose.
Hence using the not greatly inspiring 'main' as a starter offering would match that desire that the user should, ideally, make their own choice.
Quoted 2 lines
And we promised to try to minimize the disruption to Git users.
...but we haven't said 'it' is an ignorable issue. There's still a lot of old documentation and inertia to overcome.
Quoted 3 lines
Ciao,
Dscho
Philip
Hello,
It's worth noting that the word "slave" comes from the en_slav_ement of Slavs (the Slavic people of Eastern Europe).
I encourage the whole git team to really think about the changes you are making.
It was just reported to me that a professional friend of mine had confusion as to why,
after initializing a new repository, they couldn't navigate to the master branch of their repository.
I understand this is back-of-the-napkin type math but stay with me for one moment.
I also understand GitHub is not all of git users, but I just pulled the number to help me out here.
If GitHub has 40 million users but let's say half of them aren't active, so now we are at 20 million.
(Replace this number with how many actual users of git are out there.)
Let's even say half of them are on board and aware of this "harmless" change to a more "sensitive" doublespeak representation of the "master" copy/branch of the repo.
That leaves us with 10 million users of git that are either unaware or are not on board. Let's say it takes 3 minutes for a user to search on the web why exactly they can't
navigate to their "master" branch. That's 30 million minutes of time wasted, or about 57 man-YEARs of time wasted.... for what?
When do we put our foot down and say enough is enough, and not everything is offensive?
Again, please reconsider making this change towards doublespeak and consider the ramifications of how much actual human life & time will be wasted.
Kind Regards,
Peter
Quoted 23 lines · Johannes Schindelin
Hi Philip,
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
It might be easier to manage for _us_, the Git developers. But every user who initializes a repository and wants to push now needs to take the extra step to give their unnamed branch ("detached HEAD" is _still_ confusing new users!!!) a name.
That would be much more disruptive than choosing a "rather dull and boring" name instead of a rather racially-charged one.
And we promised to try to minimize the disruption to Git users.
Ciao,
Dscho
Signature · 1 line
Peter
Quoted 5 lines · Peter Hadlaw
That leaves us with 10 million users of git that are either unaware or are not on board. Let's say it takes 3 minutes for a user to search on the web why exactly they can't
navigate to their "master" branch. That's 30 million minutes of time wasted, or about 57 man-YEARs of time wasted.... for what?
That's (3 mins) probably about the same amount of time as most users waste on stack overflow for Git questions, or the old 'RTFM', for their problems in a typical week anyway.
3 mins out of a 35 hr week, over a 44 week x 25 year life is 1.3 ppm, unless you work too hard and too long, where it's an even lower ppm.
There are mechanism in this series for setting the default branch name.
--
Philip
There's still a responsibility for ~57 years worth of human life that doesn't actually need to be put at risk.
Someone forgetting how to rebase a branch in some given way and then having to search is their own responsibility.
On the other hand, this is a decision made on their behalf, without their consent, ... on everyone's behalf.
If you're not going to change the default without user input, are you going to ask the user for a default branch name?
Figure out the math and annoyance on that.
Quoted 19 lines · Philip Oakley
Quoted 5 lines · Peter Hadlaw
That leaves us with 10 million users of git that are either unaware or are not on board. Let's say it takes 3 minutes for a user to search on the web why exactly they can't
navigate to their "master" branch. That's 30 million minutes of time wasted, or about 57 man-YEARs of time wasted.... for what?That's (3 mins) probably about the same amount of time as most users waste on stack overflow for Git questions, or the old 'RTFM', for their problems in a typical week anyway.
3 mins out of a 35 hr week, over a 44 week x 25 year life is 1.3 ppm, unless you work too hard and too long, where it's an even lower ppm.
There are mechanism in this series for setting the default branch name.
--
Philip
Signature · 1 line
Peter
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
As has already been mentioned by Peff, I do not think that is a workable alternative, especially given that people are generally afraid of and easily get confused by being on a detached HEAD.
And there is no such thing as unborn detached HEAD. Existing versions of Git would not consider a $GIT_DIR that does not have any HEAD, which means a new repository created by such an "initially there is no branch" version of Git cannot be accessed by any existing versions of Git.
It raises the backward incompatibility of such an approach to a whole new level that is simply unmanageable, I am afraid.
Hi Junio,
Quoted 10 lines · Junio C Hamano
Quoted 2 lines · Johannes Schindelin
So yes, I totally agree that triggering an interactive prompt by the empty value is not really a good idea (nor a particularly intuitive behavior).
Puzzled.
Nobody talked about going interactive so far and I didn't suggest it---even though I think it is a cute idea to give a "what branch name do you want to use?" prompt, I do not think it is practical.
The interactive prompt was what I understood your "a notation that asks for the basename behaviour" comment. The "ask" was what tripped me up, I always interpret that as interactive. But now that I re-read it, I understand that you had not thought that far yet.
Quoted 11 lines
I thought it was obvious, but the key to coming up with a name dynamically instead of using a fixed string is to derive from a cue the end user gives, not directly use what the end user gives. I do not think anybody in the discussion meant by "the <basename> thing" to literally use $(basename $(cwd)) output, but use it to derive a token that check-ref-format likes. As you may have already known when you wrote them, "My Documents" or the root directory case are red herring---it would be trivial to derive "MyDocuments" or "my-documents" for the former, and for the latter, it is totally OK for the deriving rule to come up with any of "unnamed", "initial", etc.
The more magic you introduce, the less intuitive the whole thing gets, and the more disruptive the change.
Quoted 3 lines
Most of the thing you said in the message I am responding to did not make much sense to me. Perhaps you can retry after reading the message you are responding to again?
Could you be a bit more specific?
Was it the "I already use the empty string to force a fall-back, it cannot also mean something else" that did not make sense?
Or my comment that special-casing values that start with a colon would look saner to me?
Or the comment about the basename in a root directory?
Or referencing the SFC statement that we want to minimize disruption?
Or my stated preference to go with main in order to fulfill that promise of minimizing the disruption to users?
Or my current plan to introduce an advise() call when running git init that tells users that the fall-back for init.defaultBranch will change soon and that users are encouraged to configure it if they care about keeping the current fall-back?
Or that all of this needs to be done with care?
The message you refer to might not have been the best example of clear communication, but it hardly deserved _that_ response.
Ciao,
Dscho
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Junio C HamanoHi Junio & Ævar,
Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Ævar Arnfjörð Bjarmason
P.S.: Shouldn't the pull patch ind18c950a69fbe using the advice
facility, notwarning()?I think
warning()is the right thing here, as it is self squelching. Setting pull.rebase (even to 'false') is sufficient---there is no need to set advise.setpullrebase to 'false' on top.
Right. The only reason to use advise() would be to allow users to squelch the warning by setting advice.*.
On the other hand, warnings are not colored, but advice messages are.
And now I realize that the same holds for init.defaultBranch: it is also self-squelching. And it also might benefit from the coloring to make it stand out a bit.
Thoughts?
Ciao,
Dscho
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
As has already been mentioned by Peff, I do not think that is a workable alternative, especially given that people are generally afraid of and easily get confused by being on a detached HEAD.
Yes, our use of the technical phrase 'detached HEAD' is confusing, compared with the more pleasant 'not on any branch', or 'not at a branch tip'. Such is the curse of knowledge.
Quoted 6 lines
And there is no such thing as unborn detached HEAD. Existing versions of Git would not consider a $GIT_DIR that does not have any HEAD, which means a new repository created by such an "initially there is no branch" version of Git cannot be accessed by any existing versions of Git.
Isn't this, essentially, because there is no 'empty/null commit' that we (HEAD) could start at? There have been a few cases where I've been 'annoyed' that we're missing that. (rather than the orphan branch approach)
Quoted 3 lines
It raises the backward incompatibility of such an approach to a whole new level that is simply unmanageable, I am afraid.
OK, accepted.
Philip
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Ævar Arnfjörð BjarmasonHi Ævar,
I agree with pretty much all you said, just wanted to comment on a couple things:
Quoted 7 lines · Ævar Arnfjörð Bjarmason
In case I didn't make it clear I have no objection entirely replacing "master" with "main" in the tests. I just had a practical concern/question about coverage while it was landing, and a suggestion of whether perhaps there was an easier/faster way to do the "init" change first by omitting some of the test churn.
But if you want to do all the legwork that's fine by me :)
I started it, I finish it, I guess. Well, technically Don started it...
Quoted 6 lines
I think some of the people advocating this change can rightly look at some of the previous E-Mail traffic and see what are at best rants and at worst some political grandstanding that's at best pretty irrelevant to any proposed changes in git.git.
But that doesn't mean that there aren't some legitimate concerns.
And that's so sad to read. It is disheartening how eager certain people were to drown out others' voices, then claiming that they had not heard any views opposing their own. I mean, yeah, if you want to hear other opinions, it sure helps to stop talking for a while, and to start listening.
I consider myself lucky that I _did_ get the chance to listen. Related to my work in GSoC and Outreachy, and through my day job, wonderful people approached me with their stories and perspectives. I am really glad that I had the opportunity to hear those.
As to legitimate concerns: yes, you are right. There are those. If your documentation says that you should avoid committing directly to the master branch, and then you clone a popular Open Source project and it does not even _have_ a master branch, that might be a bit puzzling.
Note that I used a clone as an example, not git init, because it is a much more common operation. Git is a tool for developers to communicate, in a way, after all, even if it _can_ be used for working in isolation, too. Hence clones outnumber inits. And that communication of ideas, of code, and to combine efforts, to collaborate, that is what Git really facilitates. That is why I find it so important to be inclusive, to be inviting underrepresented developers. There is such a lot of untapped potential there, and even if using a non-offensive default branch name is but a _teeny_ tiny step to open the door a little, it is at least a step in the right direction.
Now, since I mentioned clone: please note that the default branch name used in a clone is squarely outside the Git project's control. It is decided by the maintainer(s)/communities of the respective projects. And that's exactly how it should be.
Therefore, as you said before, it does not really matter all that much at what date we will change the fall-back for init.defaultBranch.
At the same time, I still think that it is valuable to transition the test suite _now_, to be as independent on a specific default branch name as possible, if only to ensure that above-mentioned projects can choose freely what they want their primary branch to be called and Git works just fine.
Quoted 5 lines
I do 100% agree that the s/master/main/g change of the default should be made in one form or another. In my mind that doesn't even require a consideration of the political motivations at this point as far as git.git is concerned, just:
Quoted 7 lines
1. Major Git hosting providers already made the change
2. Realistically a lot/majority of git's user base interact with that in a major way.
3. A discrepancy in any default between
/usr/bin/gitand those providers is more confusing than not.
Right.
I originally thought that we should switch the default branch name in v2.30 for that reason, but I now think that adding that advice is probably a less disruptive, and almost equally supportive solution.
Quoted 9 lines
4. #3 doesn't mean they say "jump" we say "how high" whatever the change is.
But in this case the default is an entirely arbitrary default. Not e.g. that they decided to add some ill-thought out header to the object format or whatever.
P.S.: Shouldn't the pull patch ind18c950a69fbe using the advice
facility, notwarning()?
I submitted a patch for that, but unfortunately forgot to Cc: you:
https://lore.kernel.org/git/[email protected]
Ciao,
Dscho
Quoted 8 lines · Philip Oakley
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
Quoted 6 lines
Quoted 3 lines
As has already been mentioned by Peff, I do not think that is a workable alternative, especially given that people are generally afraid of and easily get confused by being on a detached HEAD.
Yes, our use of the technical phrase 'detached HEAD' is confusing, compared with the more pleasant 'not on any branch', or 'not at a branch tip'. Such is the curse of knowledge.
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
I wonder why Git didn't rather adopt "unnamed branch" or "nameless branch" to describe this mode of operation?
-- Sergey
Quoted 16 lines · Sergey Organov
Quoted 8 lines · Philip Oakley
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
Quoted 6 lines
Quoted 3 lines
As has already been mentioned by Peff, I do not think that is a workable alternative, especially given that people are generally afraid of and easily get confused by being on a detached HEAD.
Yes, our use of the technical phrase 'detached HEAD' is confusing, compared with the more pleasant 'not on any branch', or 'not at a branch tip'. Such is the curse of knowledge.
Quoted 6 lines
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
I wonder why Git didn't rather adopt "unnamed branch" or "nameless branch" to describe this mode of operation?
Given the ephemeral nature of branches they sound like good suggestion.
However I suspect "history" to be the "why" of the current 'detached head' usage.
Maybe it's a side reference to Nearly Headless Nick or other discussions of the time (aka lost in history)?
--
Philip
Quoted 17 lines · Philip Oakley
Quoted 16 lines · Sergey Organov
Quoted 14 lines · Philip Oakley
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Philip Oakley
An alternative in the other direction is to go with the 'not currently on any branch' (detached at nowhere) but then require users to deliberately create their first branch with their chosen name. This moves the 'backward incompatibility' to a different place, which may be easier to manage.
As has already been mentioned by Peff, I do not think that is a workable alternative, especially given that people are generally afraid of and easily get confused by being on a detached HEAD.
Yes, our use of the technical phrase 'detached HEAD' is confusing, compared with the more pleasant 'not on any branch', or 'not at a branch tip'. Such is the curse of knowledge.
Quoted 8 lines
Quoted 6 lines
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
I wonder why Git didn't rather adopt "unnamed branch" or "nameless branch" to describe this mode of operation?
Given the ephemeral nature of branches they sound like good suggestion.
Sure, so to me they sound even more natural in Git context than in any other VCS I'm aware of.
Quoted 5 lines
However I suspect "history" to be the "why" of the current 'detached head' usage.
Maybe it's a side reference to Nearly Headless Nick or other discussions of the time (aka lost in history)?
I do have a few commits at which HEAD has been detached, not once at some. Bloody they are.
-- Sergey
Re: [PATCH v2 28/27] tests: run tests omitted by PREPARE_FOR_MAIN_BRANCH
In reply to Johannes SchindelinQuoted 3 lines · Johannes Schindelin
The conflicts might be trivial, but every conflict makes it harder to juggle branch thickets like Junio's
seen. And those things add up. They're no fun, and they make life hard and tedious.
The worst part is they can easily be cause of unintended breakage due to mismerge.
Quoted 9 lines
t5526 conflicts _semantically_ with
pk/subsub-fetch-fix(which touches t5526 and adds a new test case referring tomaster).t9902 conflicts with
fc/bash-completion-post-2.29, and in contrast to the t5526 issue (which is trivial, even if it does require manual fixing), the t9902 is a bit more hairy to reason about.So yes, I would love to have that test coverage back, but not by making the transition to
maineven harder by reverting parts of it.
Hmph, wouldn't the forcing with GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME to 'master' be the right way to keep test coverage? After all, the primary goal is to prepare tests so that we won't lose coverage when the fallback default of init.defaultbranch is switched to 'main', and it is a secondary goal of much lessor importance to reduce the number of hits from "git grep master t/".
Quoted 3 lines
That's why I promised publicly to take care of the loose ends as quickly as I can, after the conflicting issues graduate to
next(or when they become stalled or even dropped fromseen).
Perhaps I should start to more aggressively drop topics from seen that are not sufficiently reviewed? The guiding principle ought to be "unreviewed patches are not worth applying", but I have a feeling that we have become more and more lax over time due to shortage of quality reviews. I dunno.
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Johannes SchindelinQuoted 16 lines · Johannes Schindelin
Hi Junio & Ævar,
Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Ævar Arnfjörð Bjarmason
P.S.: Shouldn't the pull patch ind18c950a69fbe using the advice
facility, notwarning()?I think
warning()is the right thing here, as it is self squelching. Setting pull.rebase (even to 'false') is sufficient---there is no need to set advise.setpullrebase to 'false' on top.Right. The only reason to use
advise()would be to allow users to squelch the warning by settingadvice.*.
Quoted 7 lines
On the other hand, warnings are not colored, but advice messages are.
And now I realize that the same holds for
init.defaultBranch: it is also self-squelching. And it also might benefit from the coloring to make it stand out a bit.Thoughts?
I do not see colors well. You'll always get "find some other way to make it stand out more to those like us---if you canhdo so without colors, that would be ideal" from me, so please don't ask me to vote for more colors.
Re: [PATCH v3 00/28] tests: use main as default branch name
In reply to Johannes Schindelin via GitGitGadget"Johannes Schindelin via GitGitGadget" <[email protected]>
Quoted 3 lines · writes:
Note that this branch is based on next, mostly because it would otherwise conflict with en/merge-tests, jk/diff-release-filespec-fix and ds/maintenance-part-3.
Note that what is queued in my tree is unlikely to be based on 'next', but instead start by merging jk/diff-release-filespec-fix and possibly the fix-up for ds/maintenance-part-3 into 'master' and then applying these patches on top.
This will be time consuming but cannot be avoided ;-)
I just started building such a topic branch. It is likely that the result of today's integration cycle would be pushed out much later than usual.
Thanks.
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Felipe ContrerasQuoted 9 lines · Felipe Contreras
Quoted 4 lines · Ævar Arnfjörð Bjarmason
I do 100% agree that the s/master/main/g change of the default should be made in one form or another. In my mind that doesn't even require a consideration of the political motivations at this point as far as git.git is concerned, just:
Others disagree.
Sure, and I might end up disagreeing with myself once we have the proposed patches & more people inevitably chime in with some useful data about the trade-offs, edge cases we haven't considered etc.
Quoted 7 lines
While the political motivation shouldn't be a central concern, I suspect the vast majority of users have no idea this change is coming, and when they see the warning they will likely complain... Strongly. The fact that this change is extremely politically charged will become a factor.
Quoted 1 line
1. Major Git hosting providers already made the change
[... addressed below ...]
Quoted 11 lines
That's their decision. The Git project shouldn't be held hostage to third party decisions.
Quoted 5 lines
2. Realistically a lot/majority of git's user base interact with that in a major way.
3. A discrepancy in any default between
/usr/bin/gitand those providers is more confusing than not.That's a problem for GitHub et al. Fortunately they can tell their users to set init.defaultbranch to whatever they want.
I think this and what you mention in another thread[1] about GitHub's instructions for creating a repository takes a narrow view of our responsibility for creating a sane UI for users.
For example, right after the instructions you note there GitHub's current instructions are:
git remote add origin $url
git branch -M main
git push -u origin main
Now, put yourself in the shoes of a novice user who's just been introduced to this "git" thing for a job they started 2 days ago. We don't take the s/master/main/g change in git.git, GitHub keeps theirs.
You followed some tutorial or read the manpage to create a local repository and made a few commits, then to upload it to GitHub or another provider that uses "main" by default you copy/pasted the above commands. Now the thing changing from "master" to "main" is one more thing you're confused by.
That's my motivation for supporting this change. I think most git users by number are (hopefully) in the future, yes, as you note we'll have version transitions where that's more confusing than not, but the same can be said about the dashed command transition.
Whatever mistakes we made in that transition and should learn from a typical git user in 2020 has never used a dashed builtin, just like a new user in 2030 probably won't know or have to care about their local default being different than a $BIG_HOSTING_PROVIDER default.
That *is* our problem, not just a problem for GitHub et al. To claim otherwise is to just bury our head in the sand.
Are we on balance going to not make the change because e.g. we don't want various paper books and tutorials to be confusing? Maybe, maybe not. But just dismissing those concerns by saying e.g. "that's O'Reilly's problem" would be as nonsensical as us pretending that perpetuating an (admittedly rather minor) UI difference in perpetuity by our inaction is purely GitHub's responsibility.
Quoted 7 lines
Quoted 6 lines
4. #3 doesn't mean they say "jump" we say "how high" whatever the change is.
But in this case the default is an entirely arbitrary default. Not e.g. that they decided to add some ill-thought out header to the object format or whatever.
Quoted 5 lines
I don't agree it is arbitrary, otherwise you could set the default to "loremipsum". Moreover, even if was arbitrary, it was arbitrary in 2005, not 2020 where "master" is already widely used in basically *all* the documentation everywhere. Some people have been using this name for 15 years, they won't give it up just like that.
Yes, that was badly phrased and I take that back. I meant to say something closer to "a common convention" or whatever. E.g. if GitHub et al for whatever reason switched all use of "origin" as the default remote to "source" I'd think that at some point we'd be improving things overall if we made that switch as well.
Quoted 2 lines
People will complain, especially if they don't see a good reason for the change.
1. https://lore.kernel.org/git/CAMP44s1515GOwTOYv-wz4qMC9Qb6d8cSVSb_CNVwun0+Yj3VxQ@mail.gmail.com/
Re: [PATCH v2 28/27] tests: run tests omitted by PREPARE_FOR_MAIN_BRANCH
In reply to Junio C HamanoHi Junio,
Quoted 16 lines · Junio C Hamano
Quoted 3 lines · Johannes Schindelin
The conflicts might be trivial, but every conflict makes it harder to juggle branch thickets like Junio's
seen. And those things add up. They're no fun, and they make life hard and tedious.The worst part is they can easily be cause of unintended breakage due to mismerge.
Quoted 7 lines
t5526 conflicts _semantically_ with
pk/subsub-fetch-fix(which touches t5526 and adds a new test case referring tomaster).t9902 conflicts with
fc/bash-completion-post-2.29, and in contrast to the t5526 issue (which is trivial, even if it does require manual fixing), the t9902 is a bit more hairy to reason about.
Quoted 5 lines
Quoted 2 lines
So yes, I would love to have that test coverage back, but not by making the transition to
maineven harder by reverting parts of it.Hmph, wouldn't the forcing with
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAMEto 'master' be the right way to keep test coverage?
Well, I was naive enough to think that this whole "let's transition the test suite to use main as default branch name" business would go over much quicker. With that expectation, I was content to already have PREPARE_FOR_MAIN-marked test cases in t5526 and t9902. They are currently skipped because that prereq is still waiting for the transition to complete.
That's what my promise was about: as soon as the competing topics settle, I want to address those two test scripts in particular, moving them over to GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main.
Quoted 9 lines
After all, the primary goal is to prepare tests so that we won't lose coverage when the fallback default of init.defaultbranch is switched to 'main', and it is a secondary goal of much lessor importance to reduce the number of hits from "git grep master t/".
Quoted 3 lines
That's why I promised publicly to take care of the loose ends as quickly as I can, after the conflicting issues graduate to
next(or when they become stalled or even dropped fromseen).
Quoted 5 lines
Perhaps I should start to more aggressively drop topics from
seenthat are not sufficiently reviewed? The guiding principle ought to be "unreviewed patches are not worth applying", but I have a feeling that we have become more and more lax over time due to shortage of quality reviews. I dunno.
FWIW I think you do a wonderful job of keeping the patch series in seen. I wish we could keep the CI build passing a bit more, but I'd rather have the branches that are in flight in one place, so that it is easy e.g. to find out whether git diff next..seen -- t/t9902\* is empty (to determine whether working on that script would cause conflicts right now).
Ciao,
Dscho
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Ævar Arnfjörð BjarmasonQuoted 12 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines · Felipe Contreras
That's a problem for GitHub et al. Fortunately they can tell their users to set init.defaultbranch to whatever they want.
I think this and what you mention in another thread[1] about GitHub's instructions for creating a repository takes a narrow view of our responsibility for creating a sane UI for users.
For example, right after the instructions you note there GitHub's current instructions are:
Quoted 8 lines
git remote add origin $url
git branch -M main
git push -u origin mainNow, put yourself in the shoes of a novice user who's just been introduced to this "git" thing for a job they started 2 days ago. We don't take the s/master/main/g change in git.git, GitHub keeps theirs.
I am.
But that doesn't change the instructions. The "git branch -M main" would still be there (for older versions of Git).
And the "git push -u origin main" would still be there, because you need to specify the branch you want to push to. Although I would have used HEAD instead of main, or even better @, which apparently doesn't work, but should work. If GitHub cares so much about these instructions, they could have fixed this so "git push -u origin @" works, why haven't they? Because they don't care as much as they claim to (see the obvious inconsistency below).
Quoted 5 lines
You followed some tutorial or read the manpage to create a local repository and made a few commits, then to upload it to GitHub or another provider that uses "main" by default you copy/pasted the above commands. Now the thing changing from "master" to "main" is one more thing you're confused by.
What if the project uses "trunk"? Or "default"?
If a project uses a non-standard name, it's their responsibility to teach their users how to interact with that project. If GitHub chose "main", it's *their* responsibility to tell their users that this is a discrepancy from most of the online documentation, including online documentation specific to GitHub.
The best way the Git project can help is by not hard-coding any of these names, so the documentation doesn't have to use "master", or "main", but can use @, or @{upstream}.
But right now the documentation *has* to hard-code these names, because of poor triangular workflow support from Git, something I tried to fix many years ago with my @{publish} patches.
If we had proper @{upstream} and @{publish} support, and taught users how to use them well, there would be no need for anyone to do "git rebase -i master" ("git rebase -i" would do).
Quoted 4 lines
That's my motivation for supporting this change. I think most git users by number are (hopefully) in the future, yes, as you note we'll have version transitions where that's more confusing than not, but the same can be said about the dashed command transition.
The number of Git users in the future directly depends on how we treat Git users in the present. And the Git users of the present would not appreciate that 99% of documentation out there uses "master", while Git does not, especially if in their mind it's due to bad (political) reasons.
What's wrong with *first* fixing the interface so we don't have to type "master" so much (e.g. by properly supporting triangular workflows), and *then* consider changing "master" later, *after* a lot of online documentation has stopped using the name "master" directly as well?
Quoted 4 lines
Whatever mistakes we made in that transition and should learn from a typical git user in 2020 has never used a dashed builtin, just like a new user in 2030 probably won't know or have to care about their local default being different than a $BIG_HOSTING_PROVIDER default.
That's *if* the current project survives in its current form. Perhaps in 2030 there will be a libgit with more than one user interface. Nobody knows the future.
Quoted 2 lines
That *is* our problem, not just a problem for GitHub et al. To claim otherwise is to just bury our head in the sand.
It is our problem to improve the interface so users don't have to type "master" (or "main), so much.
It is not our problem that GitHub decided to get ahead of itself and change their instructions without first considering other options, like improving the interface.
Quoted 6 lines
Are we on balance going to not make the change because e.g. we don't want various paper books and tutorials to be confusing? Maybe, maybe not. But just dismissing those concerns by saying e.g. "that's O'Reilly's problem" would be as nonsensical as us pretending that perpetuating an (admittedly rather minor) UI difference in perpetuity by our inaction is purely GitHub's responsibility.
GitHub can fix that UI difference *today* by retracting their instructions and instead come here and discuss with us ways to improve the interface first.
They chose that action *unilaterally* without discussing it with the Git project. That's on them.
Yes, GitHub users are our users too, but we have many more users, we shouldn't hurt them just because GitHub has no patience.
As an example of GitHub's impatience, look at GitHub's Hello World [1], the text has been updated to "main", but all the images say "master". It's their *first* guide, and it's already inconsistent.
https://guides.github.com/activities/hello-world/readme-edits.gif
Additionally, GitHub cannot say "implement X or we will hurt our users". That would be manipulative tactics, and the Git project should not succumb to those. Regardless of what GitHub does, the Git project should implement X on its own terms, if and when it has determined it's in the best interest of its users.
Moreover, you have not explained precisely how the issues will be solved by changing the default name. All the documentation out there would be inconsistent with "main". Even GitHub's own documentation is inconsistent at this precise moment.
Take one of the first results you get when googling "github how to" [2], it says to "git push -u origin master". By keeping the name "master" we are helping those users that are not using a github.com guide, and are using one of the hundreds (or thousands) of guides out there that assume the name is master. In fact, the *only* thing that is hurting GitHub users right now is those initial instructions they chose, which you can ignore, and instead use an external guide.
It is very likely that by doing this change we would actually hurt more GitHub users than not doing it.
Cheers.
[1] https://guides.github.com/activities/hello-world/
[2] https://opensource.com/article/18/1/step-step-guide-git
Signature · 1 line
Felipe Contreras
Re: [PATCH v2 28/27] tests: run tests omitted by PREPARE_FOR_MAIN_BRANCH
In reply to Johannes SchindelinQuoted 11 lines · Johannes Schindelin
Quoted 5 lines
Perhaps I should start to more aggressively drop topics from
seenthat are not sufficiently reviewed? The guiding principle ought to be "unreviewed patches are not worth applying", but I have a feeling that we have become more and more lax over time due to shortage of quality reviews. I dunno.FWIW I think you do a wonderful job of keeping the patch series in
seen. I wish we could keep the CI build passing a bit more, but I'd rather have the branches that are in flight in one place, so that it is easy e.g. to find out whethergit diff next..seen -- t/t9902\*is empty (to determine whether working on that script would cause conflicts right now).
I have to disagree. There are a few topics, perhaps more than a few, that is age old in Git timescale nobody has bothered to ask the list why we still have it in 'seen' [*1*].
It may be a good thing to pick up as many potentially interesting new topics as possible and to merge them to 'seen' while resolving possible conflicts with other topics in flight. I am willing to continue doing so.
But I doubt that a series lingering in 'seen' that has not been touched for more than say four weeks has much chance of gaining any new interest to push it forward. Perhaps we need a policy to discard a topic whose author timestamp is 8 weeks or older and not in 'next', without preventing those who care about the topic from resurrecting it in support, or something along that line.
[Footnote]
*1* The question can be asked in two ways. "Shouldn't it go 'next' already? I've read it over, here is the review and the thread shows a clear concensus that it is a good idea" is one happy outcome (even though that would indicate the maintainer doing a poor job).
Alternatively, "Shouldn't it be discarded? Nobody seemed interested back then and now we have X instead, so it is not necessary." is also a possible happy outcome.
Quoted 3 lines · Sergey Organov
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
Aren't you confused about what "on a branch" means?
After either of these two operations, your HEAD may point at the same commit, but the former is on a branch (the master branch), and the latter is not.
git checkout master
git checkout master^0
The difference between these two states does *NOT* come from which commit HEAD points at.
The difference comes from what happens when you make a new commit starting from that state. The former (i.e. you are on a branch) grows the branch. The latter (i.e. you are not on a branch) does not grow any branch.
This is an unrelated trivia, but did anybody know that we were pretty much on the detached HEAD all the time for more than a month of early life of Git, until cad88fdf (git-init-db: set up the full default environment, 2005-05-30)?
Quoted 7 lines · Junio C Hamano
Quoted 3 lines · Sergey Organov
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
Aren't you confused about what "on a branch" means?
I believe I'm not.
Quoted 10 lines
After either of these two operations, your HEAD may point at the same commit, but the former is on a branch (the master branch), and the latter is not.
git checkout master
git checkout master^0The difference between these two states does *NOT* come from which commit HEAD points at.
Sure.
Quoted 4 lines
The difference comes from what happens when you make a new commit starting from that state. The former (i.e. you are on a branch) grows the branch.
Sure.
Quoted 1 line
The latter (i.e. you are not on a branch) does not grow any branch.
That's one way of looking at it, resulting in this "detached HEAD" thingy that is too technical for the git user proper, I think. Moreover, it immediately raises the question: if it doesn't grow any branch, /what/ does it grow?
Another way of describing it, that I prefer, is that you /are/ on an /unnamed/ branch and new commits grow this particular /unnamed/ branch. No need not only for "detached", but even for "HEAD" to be known to the user to get the idea, I think.
Quoted 5 lines
This is an unrelated trivia, but did anybody know that we were pretty much on the detached HEAD all the time for more than a month of early life of Git, until
cad88fdf(git-init-db: set up the full default environment, 2005-05-30)?
I was not aware, and it seems that in my terminology it'd sound: "Git didn't have named branches until cad88fdf".
-- Sergey
Quoted 9 lines · Sergey Organov
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Sergey Organov
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
Aren't you confused about what "on a branch" means?
I believe I'm not.
Isn't this one of those "implementation detail" viewpoint arguments, combined with some incompleteness in various places.
From a naive english user perspective , 'on' a branch can also mean anywhere along a branch and not just at the tip. Being at a commit along a branch can be tricky to appreciate (that on/at distinction isn't immediately obvious..)
Quoted 11 lines
Quoted 10 lines
After either of these two operations, your HEAD may point at the same commit, but the former is on a branch (the master branch), and the latter is not.
git checkout master
git checkout master^0The difference between these two states does *NOT* come from which commit HEAD points at.
Sure.
From an implementation perspective one can go two ways, and we tell the user which way we went, even though, ultimately, we look at the same commit.
Though, for an unborn branch we don't have a null commit value (c.f. empty tree) to help in being 'detached at nowhere'.
Quoted 12 lines
Quoted 4 lines
The difference comes from what happens when you make a new commit starting from that state. The former (i.e. you are on a branch) grows the branch.
Sure.
Quoted 1 line
The latter (i.e. you are not on a branch) does not grow any branch.
That's one way of looking at it, resulting in this "detached HEAD" thingy that is too technical for the git user proper, I think. Moreover, it immediately raises the question: if it doesn't grow any branch, /what/ does it grow?
Quoted 4 lines
Another way of describing it, that I prefer, is that you /are/ on an /unnamed/ branch and new commits grow this particular /unnamed/ branch. No need not only for "detached", but even for "HEAD" to be known to the user to get the idea, I think.
I don't think we can start like this and continue with a commit on top of the orphaned 'unnamed' branch. (Not tried it though..)
Quoted 9 lines
Quoted 5 lines
This is an unrelated trivia, but did anybody know that we were pretty much on the detached HEAD all the time for more than a month of early life of Git, until
cad88fdf(git-init-db: set up the full default environment, 2005-05-30)?I was not aware, and it seems that in my terminology it'd sound: "Git didn't have named branches until
cad88fdf".-- Sergey
Quoted 26 lines · Philip Oakley
Quoted 9 lines · Sergey Organov
Quoted 6 lines · Junio C Hamano
Quoted 3 lines · Sergey Organov
To me "not on a branch [tip]" is also confusing, as in fact you are, as is easily seen after you perform a few commits, and now HEAD points directly to the tip of the branch (that has no other references).
Aren't you confused about what "on a branch" means?
I believe I'm not.
Isn't this one of those "implementation detail" viewpoint arguments, combined with some incompleteness in various places.
From a naive english user perspective , 'on' a branch can also mean anywhere along a branch and not just at the tip. Being at a commit along a branch can be tricky to appreciate (that on/at distinction isn't immediately obvious..)
Quoted 8 lines
Quoted 8 lines
After either of these two operations, your HEAD may point at the same commit, but the former is on a branch (the master branch), and the latter is not.
git checkout master
git checkout master^0
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
The difference between these two states does *NOT* come from which commit HEAD points at.
Sure.
From an implementation perspective one can go two ways, and we tell the user which way we went, even though, ultimately, we look at the same commit.
AFAIU, the only difference is that HEAD points to the commit directly in the case of "detached HEAD", while it points to the commit indirectly through the branch reference in the usual case.
Quoted 3 lines
Though, for an unborn branch we don't have a null commit value (c.f. empty tree) to help in being 'detached at nowhere'.
We can pretend we have a null commit for the sake of regularity, even though Git implementation has none.
Actually, it looks like a few things would be easier if Git got the "Adam" commit that is the ultimate final parent of everything in the first place, but it didn't.
Quoted 12 lines
Quoted 12 lines
Quoted 4 lines
The difference comes from what happens when you make a new commit starting from that state. The former (i.e. you are on a branch) grows the branch.
Sure.
Quoted 1 line
The latter (i.e. you are not on a branch) does not grow any branch.
That's one way of looking at it, resulting in this "detached HEAD" thingy that is too technical for the git user proper, I think. Moreover, it immediately raises the question: if it doesn't grow any branch, /what/ does it grow?
Quoted 6 lines
Quoted 4 lines
Another way of describing it, that I prefer, is that you /are/ on an /unnamed/ branch and new commits grow this particular /unnamed/ branch. No need not only for "detached", but even for "HEAD" to be known to the user to get the idea, I think.
I don't think we can start like this and continue with a commit on top of the orphaned 'unnamed' branch. (Not tried it though..)
I rather believe we can, no problems, and that's why "detached HEAD" behaves exactly as unnamed branch would.
To make it obvious "detached HEAD" is in fact a subset of the usual case, imagine that "detached HEAD" is rather first implemented by pointing to a branch reference with a hidden name that in turn points to the commit, and then this "incognito branch reference" is optimized-out as being invisible anyway, so HEAD now points to the commit itself.
-- Sergey Organov
Quoted 12 lines · Sergey Organov
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
The latter (i.e. you are not on a branch) does not grow any branch.
That's one way of looking at it, resulting in this "detached HEAD" thingy that is too technical for the git user proper, I think. Moreover, it immediately raises the question: if it doesn't grow any branch, /what/ does it grow?
Quoted 6 lines
Quoted 4 lines
Another way of describing it, that I prefer, is that you /are/ on an /unnamed/ branch and new commits grow this particular /unnamed/ branch. No need not only for "detached", but even for "HEAD" to be known to the user to get the idea, I think.
I don't think we can start like this and continue with a commit on top of the orphaned 'unnamed' branch. (Not tried it though..)
Quoted 9 lines
I rather believe we can, no problems, and that's why "detached HEAD" behaves exactly as unnamed branch would.
To make it obvious "detached HEAD" is in fact a subset of the usual case, imagine that "detached HEAD" is rather first implemented by pointing to a branch reference with a hidden name that in turn points to the commit, and then this "incognito branch reference" is optimized-out as being invisible anyway, so HEAD now points to the commit itself.
Thinking about some options...
After a git init: We can hack HEAD to "ref: refs/heads/" (i.e. a symref to an unnamed branch) and git status will report "No commits yet". My PS1 will report the current branch as "()" (i.e. an empty name).
However,git branch reports "Failed to resolve HEAD as a valid ref.", and git commit reports "cannot lock ref 'HEAD': there is a non-empty directory '.git/refs/heads/' blocking reference 'refs/heads/'".
So, there could be the option to detect that unnamed ref state (no characters after the final "/") without going "Fatal:".
However there is still the potential difficulty that after the first commit on that unnamed branch we would have the difficult choice of:
- either keeping that unnamed ref/branch symref, and have nowhere to hold the new commit name (oid), because HEAD is already acting as the place holder for the symref,
- or we have to lose the place holder symref and place the new commit oid into HEAD, leaving us back at the regular "detached head", but for an as yet unnamed orphan branch.
(tested on Windows[1])
For the second case we would still need to ensure that protections are in place to avoid loosing those detached commits if the user switches/checks out to new branch based on some other oid. (for that to happen then that checkout oid must be somewhere in the unnamed branch, but the latest tip commits should need checking to prevent unexpected loss - the current warning may not be enough...)
At the moment there is a lot of 'lock-in' for the status quo, and the alternative may not be any better, and have some backward compatibility issues, though those may be overstated, depending on how repos are being 'shared'.
Philip
[1]
phili@Philip-Win10 MINGW64 /c/git-sdk-64/usr/src/unnamed ()
$ git version git version 2.29.2.windows.2
Quoted 10 lines · Sergey Organov
Quoted 1 line · Junio C Hamano
The latter (i.e. you are not on a branch) does not grow any branch.
That's one way of looking at it, resulting in this "detached HEAD" thingy that is too technical for the git user proper, I think. Moreover, it immediately raises the question: if it doesn't grow any branch, /what/ does it grow?
Quoted 4 lines
Another way of describing it, that I prefer, is that you /are/ on an /unnamed/ branch and new commits grow this particular /unnamed/ branch. No need not only for "detached", but even for "HEAD" to be known to the user to get the idea, I think.
This is precisely what it is conceptually.
And there's absolutely no need for the user to know what HEAD is behind the curtains, especially since they can just use @, and think of it as "the current branch".
It is clearly a branch, for example you can do "git push origin @:my-fix".
Cheers.
Signature · 1 line
Felipe Contreras
Quoted 1 line · Felipe Contreras
It is clearly a branch, for example you can do "git push origin @:my-fix".
Hmm, you can also do "git push origin c2f3bf071e:maintenance", but it does not make a bare object name a branch.
At least I doubt the "clearly" part of your statement. There might be a better example to support the above claim, but this one is not.
Re: [RFC/PATCH] tests: support testing with an arbitrary default branch (sort of)
In reply to Junio C HamanoHi Junio,
Quoted 22 lines · Junio C Hamano
Quoted 20 lines · Johannes Schindelin
Quoted 8 lines · Junio C Hamano
Quoted 2 lines · Ævar Arnfjörð Bjarmason
P.S.: Shouldn't the pull patch ind18c950a69fbe using the advice
facility, notwarning()?I think
warning()is the right thing here, as it is self squelching. Setting pull.rebase (even to 'false') is sufficient---there is no need to set advise.setpullrebase to 'false' on top.Right. The only reason to use
advise()would be to allow users to squelch the warning by settingadvice.*.On the other hand, warnings are not colored, but advice messages are.
And now I realize that the same holds for
init.defaultBranch: it is also self-squelching. And it also might benefit from the coloring to make it stand out a bit.
Quoted 6 lines
Quoted 1 line
Thoughts?
I do not see colors well. You'll always get "find some other way to make it stand out more to those like us---if you canhdo so without colors, that would be ideal" from me, so please don't ask me to vote for more colors.
From a purely selfish point of view: colors _do_ serve me well. And from a maintainer's point of view: I added my share of coloring based on users' feedback, so I think that even if it does not benefit everybody equally well, it is valuable to add coloring where helpful.
As to the aspect "find some other way to make it stand out", I believe that advise() addresses that _also_, by virtue of prefixing the lines with the uniform hint: prefix (which stands out visually, at least to me, maybe it also does that for you?).
Ciao,
Dscho