diff mbox series

[01/10] fmt-merge-msg: also suppress "into main" by default

Message ID cf950c6f6a48f9a6ad55ac027afbc0640f9a535d.1603135902.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Prepare for changing the default branch name main (last manual part) | expand

Commit Message

Johannes Schindelin Oct. 19, 2020, 7:31 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

In preparation for changing the default branch name to `main`, let's
skip the suffix "into main" in merge commit messages.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 fmt-merge-msg.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Junio C Hamano Oct. 21, 2020, 10:12 p.m. UTC | #1
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In preparation for changing the default branch name to `main`, let's
> skip the suffix "into main" in merge commit messages.

Hmph, we reversed the course from "no suppression" to "suppress
master as we've always done" because otherwise we'd add _more_
instances of 6-letter string 'master' to our codebase, and that
was to be avoided.  There is no such "let's avoid saying main"
desire, is there?

I can see why a series about updating tests would want a change like
this (i.e. to avoid patches that have to add 'into main' everywhere
to the expected output), but as to the desired behaviour of the
default behaviour of "git merge" command, I am not sure this goes
into the right direction.  After all, there are those (including me)
who find the idea of having one single thing (in this case a branch)
that is special among others is objectionable in itself, not what
word (e.g. 'master') is used to call that single "special" thing.

Having said all that, let me keep my suggested change to the very
minimum.  Let's end the proposed log message with

    ..., let's skip the suffix "into main" in merge commit messages,
    the same way that "into master" has been skipped by default.

That would justify why we are still special casing the new word.

Thanks.

> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  fmt-merge-msg.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
> index bd22e1ea88..9a664a4a58 100644
> --- a/fmt-merge-msg.c
> +++ b/fmt-merge-msg.c
> @@ -626,8 +626,10 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
>  	void *current_branch_to_free;
>  	struct merge_parents merge_parents;
>  
> -	if (!suppress_dest_pattern_seen)
> +	if (!suppress_dest_pattern_seen) {
> +		string_list_append(&suppress_dest_patterns, "main");
>  		string_list_append(&suppress_dest_patterns, "master");
> +	}
>  
>  	memset(&merge_parents, 0, sizeof(merge_parents));
Johannes Schindelin Oct. 22, 2020, 12:28 p.m. UTC | #2
Hi Junio,

On Wed, 21 Oct 2020, Junio C Hamano wrote:

> "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
> writes:
>
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > In preparation for changing the default branch name to `main`, let's
> > skip the suffix "into main" in merge commit messages.
>
> Hmph, we reversed the course from "no suppression" to "suppress
> master as we've always done" because otherwise we'd add _more_
> instances of 6-letter string 'master' to our codebase, and that
> was to be avoided.  There is no such "let's avoid saying main"
> desire, is there?
>
> I can see why a series about updating tests would want a change like
> this (i.e. to avoid patches that have to add 'into main' everywhere
> to the expected output), but as to the desired behaviour of the
> default behaviour of "git merge" command, I am not sure this goes
> into the right direction.  After all, there are those (including me)
> who find the idea of having one single thing (in this case a branch)
> that is special among others is objectionable in itself, not what
> word (e.g. 'master') is used to call that single "special" thing.

The reason I did it this way is to benefit from a straight-forward
`s/master/main/g`...

> Having said all that, let me keep my suggested change to the very
> minimum.  Let's end the proposed log message with
>
>     ..., let's skip the suffix "into main" in merge commit messages,
>     the same way that "into master" has been skipped by default.
>
> That would justify why we are still special casing the new word.

I changed it this way.

Thanks,
Dscho
diff mbox series

Patch

diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c
index bd22e1ea88..9a664a4a58 100644
--- a/fmt-merge-msg.c
+++ b/fmt-merge-msg.c
@@ -626,8 +626,10 @@  int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
 	void *current_branch_to_free;
 	struct merge_parents merge_parents;
 
-	if (!suppress_dest_pattern_seen)
+	if (!suppress_dest_pattern_seen) {
+		string_list_append(&suppress_dest_patterns, "main");
 		string_list_append(&suppress_dest_patterns, "master");
+	}
 
 	memset(&merge_parents, 0, sizeof(merge_parents));