{"thread":{"id":"56800","subject":"conflict markers in markdown files","startedAt":"2021-10-28T14:00:43Z","lastAt":"2021-10-29T05:08:10Z","messageCount":9,"participants":["Nicholas Bransby-Williams","Philip Oakley","Junio C Hamano","rsbecker@nexbridge.com"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"439870","messageId":"CAGyLXMBWyfcBVFDRbYJMk+-RjjNBQDvoDeaBtEPiXpUDDTqfOA@mail.gmail.com","threadId":"56800","inReplyTo":null,"subject":"conflict markers in markdown files","fromName":"Nicholas Bransby-Williams","fromEmail":"nbransby@gmail.com","sentAt":"2021-10-28T14:00:08Z","receivedAt":"2021-10-28T14:00:43Z","isPatch":false,"sender":{"key":"nbransby@gmail.com","avatar":"https://gravatar.com/avatar/675feb05d78f6534106e116233021eb150e14905046ad0d0327df23c516a266e?d=mp&s=160"},"body":"Isn't it quite unfortunate that markdown chose setext-style headers by\n“underlining” with equal signs (=) meaning if a header is 7 characters\nlong it's going to clash with the git conflicts markers (example\nbelow).\n\nWould it make sense to add an option to merge-file so merge tools can\nspecify a custom marker that is statistically much less likely to\nclash with the kinds of text files that are typically stored in git\nrepositories?\n\ncat ./ours.md\nA Second Level Header\n---------------------\nOurs\n=======\nIts ours\nThe quick brown fox jumped over the lazy\ndog's back.\n\ncat ./base.md\nA Second Level Header\n---------------------\nThe quick brown fox jumped over the lazy\ndog's back.\n\ncat ./theirs.md\nA Second Level Header\n---------------------\nTheirs\n=======\nIts theirs\nThe quick brown fox jumped over the lazy\ndog's back.\n\ngit merge-file -p ./ours.md ./base.md ./theirs.md\nA Second Level Header\n---------------------\n<<<<<<< ./ours.md\nOurs\n=======\nIts ours\n=======\nTheirs\n=======\nIts theirs\n>>>>>>> ./theirs.md\nThe quick brown fox jumped over the lazy\ndog's back.\n"},{"id":"439877","messageId":"9561c0de-fb97-093b-4615-6d6d7d595d51@iee.email","threadId":"56800","inReplyTo":"CAGyLXMBWyfcBVFDRbYJMk+-RjjNBQDvoDeaBtEPiXpUDDTqfOA@mail.gmail.com","subject":"Re: conflict markers in markdown files","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-10-28T15:38:52Z","receivedAt":"2021-10-28T15:38:56Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"On 28/10/2021 15:00, Nicholas Bransby-Williams wrote:\n> Isn't it quite unfortunate that markdown chose setext-style headers by\n> “underlining” with equal signs (=) meaning if a header is 7 characters\n> long it's going to clash with the git conflicts markers (example\n> below).\n>\n> Would it make sense to add an option to merge-file so merge tools can\n> specify a custom marker that is statistically much less likely to\n> clash with the kinds of text files that are typically stored in git\n> repositories?\n>\n> cat ./ours.md\n> A Second Level Header\n> ---------------------\n> Ours\n> =======\n> Its ours\n> The quick brown fox jumped over the lazy\n> dog's back.\n>\n> cat ./base.md\n> A Second Level Header\n> ---------------------\n> The quick brown fox jumped over the lazy\n> dog's back.\n>\n> cat ./theirs.md\n> A Second Level Header\n> ---------------------\n> Theirs\n> =======\n> Its theirs\n> The quick brown fox jumped over the lazy\n> dog's back.\n>\n> git merge-file -p ./ours.md ./base.md ./theirs.md\n> A Second Level Header\n> ---------------------\n> <<<<<<< ./ours.md\n> Ours\n> =======\n> Its ours\n> =======\n> Theirs\n> =======\n> Its theirs\n>>>>>>>> ./theirs.md\n\nIn a similar vein, the above `>>>>>>> ./theirs.md` is being formatted as\nrepeated side bars in Thunderbird. But that's someone else's problem ;-)\n\n> The quick brown fox jumped over the lazy\n> dog's back.\n\n"},{"id":"439931","messageId":"xmqq5ytgrkku.fsf@gitster.g","threadId":"56800","inReplyTo":"CAGyLXMBWyfcBVFDRbYJMk+-RjjNBQDvoDeaBtEPiXpUDDTqfOA@mail.gmail.com","subject":"Re: conflict markers in markdown files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-28T19:54:57Z","receivedAt":"2021-10-28T19:55:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n\n> Would it make sense to add an option to merge-file so merge tools can\n> specify a custom marker that is statistically much less likely to\n> clash with the kinds of text files that are typically stored in git\n> repositories?\n\nIs the conflict-marker-size attribute sufficient?  If not, why?\n\nIn our documentation, we do need to have literal runs of '<<<',\n'===', etc. to illustrate and describe the conflict markers, so we\nhave these in .gitattributes at the top-level:\n\n    /Documentation/git-merge.txt conflict-marker-size=32\n    /Documentation/gitk.txt conflict-marker-size=32\n    /Documentation/user-manual.txt conflict-marker-size=32\n\nso that the auto-inserted conflict markers will be very long,\ninstead of just the default (was it 7?  I do not remember offhand\nbecause I do not have to).  Most importantly, these \"32\" are written\nby folks who wrote these documentation pages and *knew* that there\nis no runs of '<', '=', '|' or '>' that are 32 letters long, so it\nis safe and can be updated to stay safe when the documentation files\nchange.\n"},{"id":"439936","messageId":"CAGyLXMA93qQw_h97bMd14O26hSxn4xn+AzemVyrf6pn53qO3UQ@mail.gmail.com","threadId":"56800","inReplyTo":"xmqq5ytgrkku.fsf@gitster.g","subject":"Re: conflict markers in markdown files","fromName":"Nicholas Bransby-Williams","fromEmail":"nbransby@gmail.com","sentAt":"2021-10-28T20:33:45Z","receivedAt":"2021-10-28T20:33:58Z","isPatch":false,"sender":{"key":"nbransby@gmail.com","avatar":"https://gravatar.com/avatar/675feb05d78f6534106e116233021eb150e14905046ad0d0327df23c516a266e?d=mp&s=160"},"body":"I guess using such a long marker makes it less likely but there no\nreason you wouldn't have a 32 character long title in markdown\n\nExample.... :)\n\nAn important heading in markdown\n================================\n\n\nOn Thu, 28 Oct 2021 at 20:55, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n>\n> > Would it make sense to add an option to merge-file so merge tools can\n> > specify a custom marker that is statistically much less likely to\n> > clash with the kinds of text files that are typically stored in git\n> > repositories?\n>\n> Is the conflict-marker-size attribute sufficient?  If not, why?\n>\n> In our documentation, we do need to have literal runs of '<<<',\n> '===', etc. to illustrate and describe the conflict markers, so we\n> have these in .gitattributes at the top-level:\n>\n>     /Documentation/git-merge.txt conflict-marker-size=32\n>     /Documentation/gitk.txt conflict-marker-size=32\n>     /Documentation/user-manual.txt conflict-marker-size=32\n>\n> so that the auto-inserted conflict markers will be very long,\n> instead of just the default (was it 7?  I do not remember offhand\n> because I do not have to).  Most importantly, these \"32\" are written\n> by folks who wrote these documentation pages and *knew* that there\n> is no runs of '<', '=', '|' or '>' that are 32 letters long, so it\n> is safe and can be updated to stay safe when the documentation files\n> change.\n"},{"id":"439959","messageId":"xmqqilxgpywf.fsf@gitster.g","threadId":"56800","inReplyTo":"CAGyLXMA93qQw_h97bMd14O26hSxn4xn+AzemVyrf6pn53qO3UQ@mail.gmail.com","subject":"Re: conflict markers in markdown files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-28T22:28:32Z","receivedAt":"2021-10-28T22:28:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n\n> I guess using such a long marker makes it less likely but there no\n> reason you wouldn't have a 32 character long title in markdown\n>\n> Example.... :)\n>\n> An important heading in markdown\n> ================================\n\nYou probably missed the part that I said .gitattributes is under\ncontrol of those who are editing the files the entry refers to.  So\nwhen you edit the file and add such a line, you can easily edit the\nattributes file and pick an appropriate number.\n"},{"id":"439965","messageId":"CAGyLXMBe2qj8mT+gA2skQr=+bteV9E0nKZ=u-5akCQtTU7AfKA@mail.gmail.com","threadId":"56800","inReplyTo":"xmqqilxgpywf.fsf@gitster.g","subject":"Re: conflict markers in markdown files","fromName":"Nicholas Bransby-Williams","fromEmail":"nbransby@gmail.com","sentAt":"2021-10-28T22:49:23Z","receivedAt":"2021-10-28T22:49:38Z","isPatch":false,"sender":{"key":"nbransby@gmail.com","avatar":"https://gravatar.com/avatar/675feb05d78f6534106e116233021eb150e14905046ad0d0327df23c516a266e?d=mp&s=160"},"body":"Thanks, I didn't miss that.\n\nI have no control over the content in the file so I don't know what an\nappropriate number is.\n\nAlthough I guess an unfeasible large one would make a clash highly unlikely.\n\nOn Thu, 28 Oct 2021 at 23:28, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n>\n> > I guess using such a long marker makes it less likely but there no\n> > reason you wouldn't have a 32 character long title in markdown\n> >\n> > Example.... :)\n> >\n> > An important heading in markdown\n> > ================================\n>\n> You probably missed the part that I said .gitattributes is under\n> control of those who are editing the files the entry refers to.  So\n> when you edit the file and add such a line, you can easily edit the\n> attributes file and pick an appropriate number.\n"},{"id":"439972","messageId":"xmqqilxgoicq.fsf@gitster.g","threadId":"56800","inReplyTo":"CAGyLXMBe2qj8mT+gA2skQr=+bteV9E0nKZ=u-5akCQtTU7AfKA@mail.gmail.com","subject":"Re: conflict markers in markdown files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-28T23:11:17Z","receivedAt":"2021-10-28T23:11:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n\n> Thanks, I didn't miss that.\n>\n> I have no control over the content in the file so I don't know what an\n> appropriate number is.\n\nThose who are editing the file would be able to adjust the\nattributes themselves, no?\n"},{"id":"439974","messageId":"00c601d7cc53$0ce58800$26b09800$@nexbridge.com","threadId":"56800","inReplyTo":"xmqqilxgoicq.fsf@gitster.g","subject":"RE: conflict markers in markdown files","fromName":"","fromEmail":"rsbecker@nexbridge.com","sentAt":"2021-10-28T23:25:04Z","receivedAt":"2021-10-28T23:25:17Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"\n\n> -----Original Message-----\n> From: Junio C Hamano <gitster@pobox.com>\nOn October 28, 2021 7:11 PM, \n> To: Nicholas Bransby-Williams <nbransby@gmail.com>\n> Cc: git@vger.kernel.org\n> Subject: Re: conflict markers in markdown files\n> \n> Nicholas Bransby-Williams <nbransby@gmail.com> writes:\n> \n> > Thanks, I didn't miss that.\n> >\n> > I have no control over the content in the file so I don't know what an\n> > appropriate number is.\n> \n> Those who are editing the file would be able to adjust the attributes\nthemselves,\n> no?\n\nIt sounds like we might need an attribute like:\n\n*.md\tconflict-marker-size=32,conflict-marker-separator='~'\n\nto stick 32 ~ characters as a separator, if going down that path. I'm not\nsure how hard this would be, but tooling other systems, like JGit and every\nclient on the planet would be painful.\n\n-Randall\n\n"},{"id":"439976","messageId":"xmqq5ytgo1u2.fsf@gitster.g","threadId":"56800","inReplyTo":"00c601d7cc53$0ce58800$26b09800$@nexbridge.com","subject":"Re: conflict markers in markdown files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-29T05:08:05Z","receivedAt":"2021-10-29T05:08:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"<rsbecker@nexbridge.com> writes:\n\n> It sounds like we might need an attribute like:\n>\n> *.md\tconflict-marker-size=32,conflict-marker-separator='~'\n>\n> to stick 32 ~ characters as a separator, if going down that path. I'm not\n> sure how hard this would be, but tooling other systems, like JGit and every\n> client on the planet would be painful.\n\nWell, the underline-style markdown headers can use tilde for headers\nbelow the level that uses hyphens, so you'd need to pick a different\nseparator letter ;-).  I agree that third-party application would\nhave trouble with an arbitrary setting of the marker appearance\n(note that our own \"rerere\" knows about the attribute).\n"}]}