{"thread":{"id":"55381","subject":"Configure default merge message","startedAt":"2021-03-24T18:58:23Z","lastAt":"2021-03-26T10:43:43Z","messageCount":6,"participants":["jost.schulte@tutanota.com","Junio C Hamano","Jeff King","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"420130","messageId":"MW_aJot--3-2@tutanota.com","threadId":"55381","inReplyTo":null,"subject":"Configure default merge message","fromName":"","fromEmail":"jost.schulte@tutanota.com","sentAt":"2021-03-24T18:57:29Z","receivedAt":"2021-03-24T18:58:23Z","isPatch":false,"sender":{"key":"jost.schulte@tutanota.com","avatar":null},"body":"Hello all,\n\nI'm using git mainly with BitBucket repositories. When I pull from a remote, the default commit message will be \"Merge branch 'source-branch-name' of https://bitbucket.org/ <https://bitbucket.org/jibbletech/jibble-2.0-client-web>repository-name into destination-branch-name\".\n\nI'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n\nRegards\nJost\n"},{"id":"420141","messageId":"xmqqk0pwxqvt.fsf@gitster.g","threadId":"55381","inReplyTo":"MW_aJot--3-2@tutanota.com","subject":"Re: Configure default merge message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-03-24T20:01:42Z","receivedAt":"2021-03-24T20:02:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"jost.schulte@tutanota.com writes:\n\n> Hello all,\n>\n> I'm using git mainly with BitBucket repositories. When I pull from a remote, the default commit message will be \"Merge branch 'source-branch-name' of https://bitbucket.org/ <https://bitbucket.org/jibbletech/jibble-2.0-client-web>repository-name into destination-branch-name\".\n>\n> I'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n>\n> Regards\n> Jost\n\nÆvar, is this something we recently made it impossible with 4e168333\n(shortlog: remove unused(?) \"repo-abbrev\" feature, 2021-01-12), or\nis there more to it than resurrecting that \"feature\" to do what Jost\nseems to want?\n\nThanks.\n"},{"id":"420162","messageId":"YFvAJU3Euxhjb+uw@coredump.intra.peff.net","threadId":"55381","inReplyTo":"xmqqk0pwxqvt.fsf@gitster.g","subject":"Re: Configure default merge message","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-03-24T22:41:41Z","receivedAt":"2021-03-24T22:42:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 24, 2021 at 01:01:42PM -0700, Junio C Hamano wrote:\n\n> > I'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n> \n> Ævar, is this something we recently made it impossible with 4e168333\n> (shortlog: remove unused(?) \"repo-abbrev\" feature, 2021-01-12), or\n> is there more to it than resurrecting that \"feature\" to do what Jost\n> seems to want?\n\nIIRC, in that earlier discussion Linus said he used a prepare-commit-msg\nhook these days instead of repo-abbrev. And it should be able to handle\nthis case, as well.\n\nSomething like this seems to work for me:\n\n  $ cat .git/hooks/prepare-commit-msg\n  #!/bin/sh\n  case \"$2\" in\n  merge)\n  \tperl -i -pe '\n  \t  s{Merge (.*) of https://github.com/gitster/git}{Merge $1}\n  \t' \"$1\"\n  \t;;\n  esac\n\n  $ git pull https://github.com/gitster/git next\n  [...]\n  $ git log -1 --format=%s\n  Merge branch 'next'\n\n-Peff\n"},{"id":"420172","messageId":"87a6qsourb.fsf@evledraar.gmail.com","threadId":"55381","inReplyTo":"xmqqk0pwxqvt.fsf@gitster.g","subject":"Re: Configure default merge message","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-25T02:02:48Z","receivedAt":"2021-03-25T02:03:38Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Mar 24 2021, Junio C Hamano wrote:\n\n> jost.schulte@tutanota.com writes:\n>\n>> Hello all,\n>>\n>> I'm using git mainly with BitBucket repositories. When I pull from a remote, the default commit message will be \"Merge branch 'source-branch-name' of https://bitbucket.org/ <https://bitbucket.org/jibbletech/jibble-2.0-client-web>repository-name into destination-branch-name\".\n>>\n>> I'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n>>\n>> Regards\n>> Jost\n>\n> Ævar, is this something we recently made it impossible with 4e168333\n> (shortlog: remove unused(?) \"repo-abbrev\" feature, 2021-01-12), or\n> is there more to it than resurrecting that \"feature\" to do what Jost\n> seems to want?\n\nPerhaps I'm using it incorrectly, but I don't see how that repo-abbrev\nfeature ever resulted in the insertion of this munged content into the\nactual commit object.\n\nThe shortlog examples of \"...\" in 4e168333 are of shortlog's output\nbeing modified on the fly. Not of them being inserted into commits.\n\nYou can run \"git merge\" with \"--log\" which says it inserts \"shortlog\"\noutput. So I thought that maybe lines that were not the first \"Merge\n... into\" line in the message could have gotten munged in this way\nbefore my change.\n\nBut I don't think that happened either, and reverting 4e168333 and doing\na merge --log locally with e.g. \"# repo-abbrev: branch\" does not munge\nthe string \"branch\" in either the subject or the body, it's retained,\ne.g.:\n    \n    commit 02c864e58da (HEAD)\n    Merge: 353c73510dc c6d63de00ff\n    Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n    Date:   Thu Mar 25 03:00:21 2021 +0100\n    \n        Merge branch 'to-merge' into HEAD\n        \n        * to-merge:\n          Merge this branch blah blah\n    \n\nThat's because \"merge\" never used the munging.\n\nIf you look at the code in 7595e2ee6ef (git-shortlog: make common\nrepository prefix configurable with .mailmap, 2006-11-25) when this\nrepo-abbrev feature was first added the \"merge\" would use\nbuiltin-fmt-merge-msg.c to format the \"shortlog\", which implemented its\nown function to do so, and didn't use the mailmap.\n\nAs to Jost's question. I think the way to do this is to use\nfmt-merge-msg, see 2102440c17f (fmt-merge-msg -m to override merge\ntitle, 2010-08-17) for an example.\n\nThat seems like it would also be simpler than Jeff King's suggestion in\nthe side-thread in <YFvAJU3Euxhjb+uw@coredump.intra.peff.net>.\n"},{"id":"420234","messageId":"MWhDYQt--3-2@tutanota.com","threadId":"55381","inReplyTo":"87a6qsourb.fsf@evledraar.gmail.com","subject":"Re: Configure default merge message","fromName":"","fromEmail":"jost.schulte@tutanota.com","sentAt":"2021-03-26T06:30:35Z","receivedAt":"2021-03-26T06:31:31Z","isPatch":false,"sender":{"key":"jost.schulte@tutanota.com","avatar":null},"body":"Thank you for the detailed explanation. Where can I see the commits that you mention?\n\n25 Mar 2021, 03:02 by avarab@gmail.com:\n\n>\n> On Wed, Mar 24 2021, Junio C Hamano wrote:\n>\n>> jost.schulte@tutanota.com writes:\n>>\n>>> Hello all,\n>>>\n>>> I'm using git mainly with BitBucket repositories. When I pull from a remote, the default commit message will be \"Merge branch 'source-branch-name' of https://bitbucket.org/ <https://bitbucket.org/jibbletech/jibble-2.0-client-web>repository-name into destination-branch-name\".\n>>>\n>>> I'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n>>>\n>>> Regards\n>>> Jost\n>>>\n>>\n>> Ævar, is this something we recently made it impossible with 4e168333\n>> (shortlog: remove unused(?) \"repo-abbrev\" feature, 2021-01-12), or\n>> is there more to it than resurrecting that \"feature\" to do what Jost\n>> seems to want?\n>>\n>\n> Perhaps I'm using it incorrectly, but I don't see how that repo-abbrev\n> feature ever resulted in the insertion of this munged content into the\n> actual commit object.\n>\n> The shortlog examples of \"...\" in 4e168333 are of shortlog's output\n> being modified on the fly. Not of them being inserted into commits.\n>\n> You can run \"git merge\" with \"--log\" which says it inserts \"shortlog\"\n> output. So I thought that maybe lines that were not the first \"Merge\n> ... into\" line in the message could have gotten munged in this way\n> before my change.\n>\n> But I don't think that happened either, and reverting 4e168333 and doing\n> a merge --log locally with e.g. \"# repo-abbrev: branch\" does not munge\n> the string \"branch\" in either the subject or the body, it's retained,\n> e.g.:\n>  \n>  commit 02c864e58da (HEAD)\n>  Merge: 353c73510dc c6d63de00ff\n>  Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>  Date:   Thu Mar 25 03:00:21 2021 +0100\n>  \n>  Merge branch 'to-merge' into HEAD\n>  \n>  * to-merge:\n>  Merge this branch blah blah\n>  \n>\n> That's because \"merge\" never used the munging.\n>\n> If you look at the code in 7595e2ee6ef (git-shortlog: make common\n> repository prefix configurable with .mailmap, 2006-11-25) when this\n> repo-abbrev feature was first added the \"merge\" would use\n> builtin-fmt-merge-msg.c to format the \"shortlog\", which implemented its\n> own function to do so, and didn't use the mailmap.\n>\n> As to Jost's question. I think the way to do this is to use\n> fmt-merge-msg, see 2102440c17f (fmt-merge-msg -m to override merge\n> title, 2010-08-17) for an example.\n>\n> That seems like it would also be simpler than Jeff King's suggestion in\n> the side-thread in <YFvAJU3Euxhjb+uw@coredump.intra.peff.net>.\n>\n"},{"id":"420253","messageId":"87v99enqkp.fsf@evledraar.gmail.com","threadId":"55381","inReplyTo":"MWhDNa_--3-2@tutanota.com","subject":"Re: Configure default merge message","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-03-26T10:43:02Z","receivedAt":"2021-03-26T10:43:43Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Mar 26 2021, jost.schulte@tutanota.com wrote:\n\n> 25 Mar 2021, 03:02 by avarab@gmail.com:\n>\n>>\n>> On Wed, Mar 24 2021, Junio C Hamano wrote:\n>>\n>>> jost.schulte@tutanota.com writes:\n>>>\n>>>> Hello all,\n>>>>\n>>>> I'm using git mainly with BitBucket repositories. When I pull from a remote, the default commit message will be \"Merge branch 'source-branch-name' of https://bitbucket.org/ <https://bitbucket.org/jibbletech/jibble-2.0-client-web>repository-name into destination-branch-name\".\n>>>>\n>>>> I'd like to configure git to omit the \"of https://bitbucket.org/repository-name\" part. How can I do that?\n>>>>\n>>>> Regards\n>>>> Jost\n>>>>\n>>>\n>>> Ævar, is this something we recently made it impossible with 4e168333\n>>> (shortlog: remove unused(?) \"repo-abbrev\" feature, 2021-01-12), or\n>>> is there more to it than resurrecting that \"feature\" to do what Jost\n>>> seems to want?\n>>>\n>>\n>> Perhaps I'm using it incorrectly, but I don't see how that repo-abbrev\n>> feature ever resulted in the insertion of this munged content into the\n>> actual commit object.\n>>\n>> The shortlog examples of \"...\" in 4e168333 are of shortlog's output\n>> being modified on the fly. Not of them being inserted into commits.\n>>\n>> You can run \"git merge\" with \"--log\" which says it inserts \"shortlog\"\n>> output. So I thought that maybe lines that were not the first \"Merge\n>> ... into\" line in the message could have gotten munged in this way\n>> before my change.\n>>\n>> But I don't think that happened either, and reverting 4e168333 and doing\n>> a merge --log locally with e.g. \"# repo-abbrev: branch\" does not munge\n>> the string \"branch\" in either the subject or the body, it's retained,\n>> e.g.:\n>>  \n>>  commit 02c864e58da (HEAD)\n>>  Merge: 353c73510dc c6d63de00ff\n>>  Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>>  Date:   Thu Mar 25 03:00:21 2021 +0100\n>>  \n>>  Merge branch 'to-merge' into HEAD\n>>  \n>>  * to-merge:\n>>  Merge this branch blah blah\n>>  \n>>\n>> That's because \"merge\" never used the munging.\n>>\n>> If you look at the code in 7595e2ee6ef (git-shortlog: make common\n>> repository prefix configurable with .mailmap, 2006-11-25) when this\n>> repo-abbrev feature was first added the \"merge\" would use\n>> builtin-fmt-merge-msg.c to format the \"shortlog\", which implemented its\n>> own function to do so, and didn't use the mailmap.\n>>\n>> As to Jost's question. I think the way to do this is to use\n>> fmt-merge-msg, see 2102440c17f (fmt-merge-msg -m to override merge\n>> title, 2010-08-17) for an example.\n>>\n>> That seems like it would also be simpler than Jeff King's suggestion in\n>> the side-thread in <YFvAJU3Euxhjb+uw@coredump.intra.peff.net>.\n>>\n>\n> Thank you for the detailed explanation. Where can I see the commits\n> that you mention?\n\n[It's good practice on this mailing list not to top-post]\n\n4e168333 is a commit in your copy of the git.git repository.\n\nThe 02c864e58da, 353c73510dc and c6d63de00ff are just something that was\npart of a throwaway experiment I ran locally.\n\nI created two branches based on git.git's 238803cb409 (the commit before\n4e168333), one added a repo-abbrev line to .mailmap, the other had a\nstring in the subject/body that would match that repo-abbrev.\n\nSo the merge shows that the \"branch\" string was not replaced with \"...\".\n\n"}]}