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

Re: [PATCH v3 0/2] fmt-merge-msg: selectively suppress "into <branch>"

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2020, 02:04 UTC
Message-ID
<xmqqy2n04ezk.fsf@gitster.c.googlers.com>
In-Reply-To
<20200731004202.GA240563@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 6 quoted lines
> This version looks OK to me. The remaining issues that came up in
> earlier discussion but I didn't see you weigh in on are:
>
>   - what should happen with a detached HEAD? We'd match HEAD in the
>     suppressDest config, which I think is quite reasonable. Not sure if
>     it's worth documenting or testing that specifically.

I think what the code with posted patch happens to do is just fine. If you say "git -c merge.suppressDest=HEA? merge $topic" while on a detached HEAD, you'll get "into HEAD" omitted.

In a workflow where you'd do
	$ git co master^0
	... enumerate the topics merged in master..jch, and redo the
	... merge, but with updated versions of these topics
	$ git shortlog jch..HEAD
	$ git range-diff jch...HEAD
	$ git diff jch..HEAD
	... after inspection, find the result satisfactory, and ...
	$ git co -B jch

I would strongly suspect that hiding "into HEAD" is not enough, so I do not think HEAD is all that relevant in the first place.

You'd rather want to "lie" about the destination branch while redoing these merges, perhaps with

	$ git merge --pretend-dest=jch topic-name

with your HEAD detached, and tell fmt-merge-msg to pretend that the merge is being made into jch branch. And that is outside the scope of this patch, though it might be a good #leftoverbits candidate.

Show 6 quoted lines
>   - should "master" be in the list even if you configure a value? That
>     would do the wrong thing if you have a non-integration master, but
>     that seems unlikely. And it would do the right thing if somebody
>     later puts "main" in merge.suppressDest, but still occasionally
>     works with "master" repos (where "right" is defined as "what they
>     probably wanted", but it is perhaps a bit magical).

If you configure, you can configure it fully without manually clearing first. If you do not configure, you get a backward compatible default. I think that is the only sensible semantics.

Besides, I thought we were aiming to make 'master' less special. When a user already has a concrete list of things to use shorter merge title for, why should 'master' be magically added to the list and force the user to explicitly clear it? I do not think that makes much sense.

Show 5 quoted lines
>   - what's the plan if we do switch init.defaultBranch to "main"? Would
>     we add default_branch() to the list of defaults alongside "master",
>     or just add "main", or just leave it and let people configure
>     independently? It doesn't need to be decided now, but maybe worth
>     thinking about.

My understanding is that much more instances of repositories come to exist by cloning than running "git init". Hence, the value you set to the init.defaultBranch has no relevance to the name of the primary branch in majority of your repositories, whose primary branch is what their origin has designated before/when you cloned.

And the latter, "what is the primary branch name for this particular repository?", is what we want to ask here. The answer to "what is the first branch name for new repository I will create?" is not a good proxy for that.

I do not mind too much, even though I doubt it will be all that useful, if we taught "init" and "clone" to record which branch is the primary one in the repository they created. We'd need to add the repo_primary_branch_name() helper to allow this caller to replace the hardcoded 'master' in the patch with it, just like "init" and "clone" may ask the repo_default_branch_name() helper what the first branch name ought to be.

In any case, I do not think I want to see more reliance of the notion that there always is one and only one single special branch in the repository, so if we can get away without it, that would be more preferrable.

Thanks.
Previous: Jeff KingNext: Jeff King
Message 31 of 42 in “Avoiding 'master' nomenclature”
  1. Linus TorvaldsJul 29, 2020
  2. Junio C HamanoJul 29, 2020
  3. Linus TorvaldsJul 29, 2020
  4. Jonathan NiederJul 29, 2020
  5. Linus TorvaldsJul 29, 2020
  6. Linus TorvaldsJul 29, 2020
  7. lego_12239@rambler.ruJul 30, 2020
  8. Jeff KingJul 31, 2020
  9. OlegJul 31, 2020
  10. Linus TorvaldsJul 29, 2020
  11. Jeff KingJul 29, 2020
  12. Linus TorvaldsJul 29, 2020
  13. Jeff KingJul 30, 2020
  14. Linus TorvaldsJul 30, 2020
  15. Jeff KingJul 30, 2020
  16. Linus TorvaldsJul 30, 2020
  17. Jeff KingJul 31, 2020
  18. Junio C HamanoJul 29, 2020
  19. Junio C HamanoJul 29, 2020
  20. Jeff KingJul 30, 2020
  21. Linus TorvaldsJul 30, 2020
  22. Michal SuchánekJul 30, 2020
  23. Jeff KingJul 30, 2020
  24. Junio C HamanoJul 30, 2020
  25. 0/2 fmt-merge-msg: selectively suppress "into <branch>"Junio C Hamano, Jul 30, 2020
  26. 2/2 fmt-merge-msg: allow merge destination to be omitted againJunio C Hamano, Jul 30, 2020
  27. 1/2 Revert "fmt-merge-msg: stop treating `master` specially"Junio C Hamano, Jul 30, 2020
  28. Eric SunshineJul 30, 2020
  29. Junio C HamanoJul 30, 2020
  30. Jeff KingJul 31, 2020
  31. Junio C HamanoJul 31, 2020
  32. Jeff KingJul 31, 2020
  33. Taylor BlauJul 31, 2020
  34. Junio C HamanoJul 31, 2020
  35. Taylor BlauJul 31, 2020
  36. Michal SuchánekAug 1, 2020
  37. Johannes SchindelinAug 10, 2020
  38. Junio C HamanoAug 10, 2020
  39. Johannes SchindelinAug 11, 2020
  40. Junio C HamanoAug 12, 2020
  41. Junio C HamanoJul 29, 2020
  42. Linus TorvaldsJul 29, 2020

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.