{"thread":{"id":"48388","subject":"[PATCH] revisions.txt: expand tabs to spaces in diagram","startedAt":"2018-04-30T21:04:54Z","lastAt":"2018-05-09T00:24:10Z","messageCount":12,"participants":["Martin Ågren","Junio C Hamano","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"346192","messageId":"20180430210430.14611-1-martin.agren@gmail.com","threadId":"48388","inReplyTo":null,"subject":"[PATCH] revisions.txt: expand tabs to spaces in diagram","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-04-30T21:04:30Z","receivedAt":"2018-04-30T21:04:54Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"The diagram renders fine in AsciiDoc before and after this patch.\nAsciidoctor, on the other hand, ignores the tabs entirely, which results\nin different indentation for different lines. The graph illustration\nearlier in the document already uses spaces instead of a tab.\n\nSigned-off-by: Martin Ågren <martin.agren@gmail.com>\n---\nCan be seen at the end of https://git-scm.com/docs/gitrevisions\n\n Documentation/revisions.txt | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex dfcc49c72c..011746b74f 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -355,15 +355,15 @@ spelt out:\n    B..C   = ^B C                C\n    B...C  = B ^F C              G H D E B C\n    B^-    = B^..B\n-\t  = ^B^1 B              E I J F B\n+          = ^B^1 B              E I J F B\n    C^@    = C^1\n-\t  = F                   I J F\n+          = F                   I J F\n    B^@    = B^1 B^2 B^3\n-\t  = D E F               D G H E F I J\n+          = D E F               D G H E F I J\n    C^!    = C ^C^@\n-\t  = C ^C^1\n-\t  = C ^F                C\n+          = C ^C^1\n+          = C ^F                C\n    B^!    = B ^B^@\n-\t  = B ^B^1 ^B^2 ^B^3\n-\t  = B ^D ^E ^F          B\n+          = B ^B^1 ^B^2 ^B^3\n+          = B ^D ^E ^F          B\n    F^! D  = F ^I ^J D           G H D F\n-- \n2.17.0\n\n"},{"id":"346425","messageId":"xmqq7eomwtid.fsf@gitster-ct.c.googlers.com","threadId":"48388","inReplyTo":"20180430210430.14611-1-martin.agren@gmail.com","subject":"Re: [PATCH] revisions.txt: expand tabs to spaces in diagram","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-02T04:50:34Z","receivedAt":"2018-05-02T04:50:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Martin Ågren <martin.agren@gmail.com> writes:\n\n> The diagram renders fine in AsciiDoc before and after this patch.\n> Asciidoctor, on the other hand, ignores the tabs entirely, which results\n> in different indentation for different lines. The graph illustration\n> earlier in the document already uses spaces instead of a tab.\n\nOuch.  We might want to teach Documentation/.gitattributes that\nindent-with-tab is unwelcome in that directory, after making this\nfix (and possibly similar ones to other files).\n"},{"id":"346429","messageId":"CAN0heSqeMFq4yVHX=8Ug3wOTEzrLXwE=PcF7UFWTRg_AbZEWWg@mail.gmail.com","threadId":"48388","inReplyTo":"xmqq7eomwtid.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCH] revisions.txt: expand tabs to spaces in diagram","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-05-02T06:20:54Z","receivedAt":"2018-05-02T06:20:58Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On 2 May 2018 at 06:50, Junio C Hamano <gitster@pobox.com> wrote:\n> Martin Ågren <martin.agren@gmail.com> writes:\n>\n>> The diagram renders fine in AsciiDoc before and after this patch.\n>> Asciidoctor, on the other hand, ignores the tabs entirely, which results\n>> in different indentation for different lines. The graph illustration\n>> earlier in the document already uses spaces instead of a tab.\n>\n> Ouch.  We might want to teach Documentation/.gitattributes that\n> indent-with-tab is unwelcome in that directory, after making this\n> fix (and possibly similar ones to other files).\n\nI actually grepped around a little for a leading tab, to see if I could\nimmediately spot any similar issues. But there are tons of tabs here\n(about 13000). Most of them work out just fine, e.g., in the OPTIONS,\nwhere we tab-indent the descriptions.\n\nSo while we could try to move away from leading tabs in Documentation/,\nit would be a huge undertaking. Any kind of \"do it while we're nearby\"\napproach would take a long time to complete. And a one-off conversion\nwould probably be a horrible idea. ;-)\n\nI just noticed another difference in how the tabs are handled. In\ngit-add.txt, which I just picked at random, the three continuation lines\nin the synopsis indent differently in AsciiDoc (which indents them more\nthan in the .txt) and Asciidoctor (which indents them less than in the\n.txt). To me, this is more of a \"if I didn't sit down and compare the\ntwo outputs, I would never think about these indentations -- they're\nboth fine\".\n\nSo it might be that the only places where leading tabs really matter is\nthis kind of diagrams. Maybe we have a handful such bugs lingering among\nthe 13000 tab-indented lines...\n\nMartin\n"},{"id":"346610","messageId":"20180504015202.GP13217@genre.crustytoothpaste.net","threadId":"48388","inReplyTo":"CAN0heSqeMFq4yVHX=8Ug3wOTEzrLXwE=PcF7UFWTRg_AbZEWWg@mail.gmail.com","subject":"Re: [PATCH] revisions.txt: expand tabs to spaces in diagram","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-04T01:52:02Z","receivedAt":"2018-05-04T01:52:12Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Wed, May 02, 2018 at 08:20:54AM +0200, Martin Ågren wrote:\n> On 2 May 2018 at 06:50, Junio C Hamano <gitster@pobox.com> wrote:\n> > Martin Ågren <martin.agren@gmail.com> writes:\n> >\n> >> The diagram renders fine in AsciiDoc before and after this patch.\n> >> Asciidoctor, on the other hand, ignores the tabs entirely, which results\n> >> in different indentation for different lines. The graph illustration\n> >> earlier in the document already uses spaces instead of a tab.\n> >\n> > Ouch.  We might want to teach Documentation/.gitattributes that\n> > indent-with-tab is unwelcome in that directory, after making this\n> > fix (and possibly similar ones to other files).\n> \n> I actually grepped around a little for a leading tab, to see if I could\n> immediately spot any similar issues. But there are tons of tabs here\n> (about 13000). Most of them work out just fine, e.g., in the OPTIONS,\n> where we tab-indent the descriptions.\n> \n> So while we could try to move away from leading tabs in Documentation/,\n> it would be a huge undertaking. Any kind of \"do it while we're nearby\"\n> approach would take a long time to complete. And a one-off conversion\n> would probably be a horrible idea. ;-)\n> \n> I just noticed another difference in how the tabs are handled. In\n> git-add.txt, which I just picked at random, the three continuation lines\n> in the synopsis indent differently in AsciiDoc (which indents them more\n> than in the .txt) and Asciidoctor (which indents them less than in the\n> .txt). To me, this is more of a \"if I didn't sit down and compare the\n> two outputs, I would never think about these indentations -- they're\n> both fine\".\n> \n> So it might be that the only places where leading tabs really matter is\n> this kind of diagrams. Maybe we have a handful such bugs lingering among\n> the 13000 tab-indented lines...\n\nI took a look at this.  Asciidoctor does seem to have some weird ideas\nabout tabs, but I think how it's handling this is converting them to\nspaces, which makes sense if you're working with HTML or XML (which do\nsome bizarre things with tabs).\n\nHowever, it's not converting them to 8 spaces, which is really what we\nwant here.  We can help both AsciiDoc and Asciidoctor do the right thing\nhere (and keep our 8-space tabs) by enclosing the diagram in a block\nlike so:\n\n[literal]\n--\n   Args   Expanded arguments    Selected commits\n   D                            G H D\n   D F                          G H I J D F\n   ^G D                         H D\n   ^D B                         E I J F B\n   ^D B C                       E I J F B C\n   C                            I J F C\n   B..C   = ^B C                C\n   B...C  = B ^F C              G H D E B C\n   B^-    = B^..B\n\t  = ^B^1 B              E I J F B\n   C^@    = C^1\n\t  = F                   I J F\n   B^@    = B^1 B^2 B^3\n\t  = D E F               D G H E F I J\n   C^!    = C ^C^@\n\t  = C ^C^1\n\t  = C ^F                C\n   B^!    = B ^B^@\n\t  = B ^B^1 ^B^2 ^B^3\n\t  = B ^D ^E ^F          B\n   F^! D  = F ^I ^J D           G H D F\n--\n\nand using the tabsize=8 attribute when invoking Asciidoctor.  I can send\na patch tomorrow which does this, which I think may be a bit nicer than\nhaving to give up tabs.\n\nThoughts?\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"346613","messageId":"xmqqmuxgtal8.fsf@gitster-ct.c.googlers.com","threadId":"48388","inReplyTo":"20180504015202.GP13217@genre.crustytoothpaste.net","subject":"Re: [PATCH] revisions.txt: expand tabs to spaces in diagram","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-04T02:32:03Z","receivedAt":"2018-05-04T02:32:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> ...  We can help both AsciiDoc and Asciidoctor do the right thing\n> here (and keep our 8-space tabs) by enclosing the diagram in a block\n> like so:\n>\n> [literal]\n> --\n>    Args   Expanded arguments    Selected commits\n>    D                            G H D\n>    D F                          G H I J D F\n>    ...\n> \t  = B ^D ^E ^F          B\n>    F^! D  = F ^I ^J D           G H D F\n> --\n>\n> and using the tabsize=8 attribute when invoking Asciidoctor.  I can send\n> a patch tomorrow which does this, which I think may be a bit nicer than\n> having to give up tabs.\n\nYeah, trying to forbid indent-with-tab has been shown to be\nunworkable so even if we tried to give up tabs, it is likely we\nwould break it by mistake.  Allowing indent-with-tab and ask the\ntool to do the right thing is obviously the right direction.\n\nThanks.\n"},{"id":"346784","messageId":"20180506204226.955739-1-sandals@crustytoothpaste.net","threadId":"48388","inReplyTo":"20180504015202.GP13217@genre.crustytoothpaste.net","subject":"[PATCH 1/2] Documentation: use 8-space tabs with Asciidoctor","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-06T20:42:25Z","receivedAt":"2018-05-06T20:42:37Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"Asciidoctor expands tabs at the beginning of a line.  However, it does\nnot expand them into 8 spaces by default.  Since we use 8-space tabs,\ntell Asciidoctor that we want 8 spaces by setting the tabsize attribute.\nThis ensures that our ASCII art renders properly.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n Documentation/Makefile | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 6232143cb9..bcd216d96c 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -184,7 +184,7 @@ ASCIIDOC = asciidoctor\n ASCIIDOC_CONF =\n ASCIIDOC_HTML = xhtml5\n ASCIIDOC_DOCBOOK = docbook45\n-ASCIIDOC_EXTRA += -acompat-mode\n+ASCIIDOC_EXTRA += -acompat-mode -atabsize=8\n ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions\n ASCIIDOC_EXTRA += -alitdd='&\\#x2d;&\\#x2d;'\n DBLATEX_COMMON =\n"},{"id":"346785","messageId":"20180506204226.955739-2-sandals@crustytoothpaste.net","threadId":"48388","inReplyTo":"20180506204226.955739-1-sandals@crustytoothpaste.net","subject":"[PATCH 2/2] Documentation: render revisions correctly under Asciidoctor","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-06T20:42:26Z","receivedAt":"2018-05-06T20:42:49Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"When creating a literal block from an indented block without any sort of\ndelimiters, Asciidoctor strips off all leading whitespace, resulting in\na misrendered chart.  Use an explicit literal block to indicate to\nAsciidoctor that we want to keep the leading whitespace.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\nA future direction we could go here would actually be to turn this into\na table, which might render more acceptably in all forms.  But I think\nthis patch provides a useful improvement and we can switch to a table\nlater if desired.\n\n Documentation/revisions.txt | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex dfcc49c72c..8f60c9f431 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -345,6 +345,7 @@ Here are a handful of examples using the Loeliger illustration above,\n with each step in the notation's expansion and selection carefully\n spelt out:\n \n+....\n    Args   Expanded arguments    Selected commits\n    D                            G H D\n    D F                          G H I J D F\n@@ -367,3 +368,4 @@ spelt out:\n \t  = B ^B^1 ^B^2 ^B^3\n \t  = B ^D ^E ^F          B\n    F^! D  = F ^I ^J D           G H D F\n+....\n"},{"id":"346840","messageId":"xmqqefioqi7v.fsf@gitster-ct.c.googlers.com","threadId":"48388","inReplyTo":"20180506204226.955739-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH 1/2] Documentation: use 8-space tabs with Asciidoctor","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-07T03:04:36Z","receivedAt":"2018-05-07T03:04:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> Asciidoctor expands tabs at the beginning of a line.  However, it does\n> not expand them into 8 spaces by default.  Since we use 8-space tabs,\n> tell Asciidoctor that we want 8 spaces by setting the tabsize attribute.\n> This ensures that our ASCII art renders properly.\n>\n> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n> ---\n>  Documentation/Makefile | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nWonderful.  Thanks.\n\n>\n> diff --git a/Documentation/Makefile b/Documentation/Makefile\n> index 6232143cb9..bcd216d96c 100644\n> --- a/Documentation/Makefile\n> +++ b/Documentation/Makefile\n> @@ -184,7 +184,7 @@ ASCIIDOC = asciidoctor\n>  ASCIIDOC_CONF =\n>  ASCIIDOC_HTML = xhtml5\n>  ASCIIDOC_DOCBOOK = docbook45\n> -ASCIIDOC_EXTRA += -acompat-mode\n> +ASCIIDOC_EXTRA += -acompat-mode -atabsize=8\n>  ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions\n>  ASCIIDOC_EXTRA += -alitdd='&\\#x2d;&\\#x2d;'\n>  DBLATEX_COMMON =\n"},{"id":"346843","messageId":"CAN0heSrth+ZheEsHuVdyUv9fcnP07O=YvK6y+=rmaGqZf7X3_w@mail.gmail.com","threadId":"48388","inReplyTo":"20180506204226.955739-2-sandals@crustytoothpaste.net","subject":"Re: [PATCH 2/2] Documentation: render revisions correctly under Asciidoctor","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-05-07T04:11:43Z","receivedAt":"2018-05-07T04:11:47Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On 6 May 2018 at 22:42, brian m. carlson <sandals@crustytoothpaste.net> wrote:\n> When creating a literal block from an indented block without any sort of\n> delimiters, Asciidoctor strips off all leading whitespace, resulting in\n> a misrendered chart.  Use an explicit literal block to indicate to\n> Asciidoctor that we want to keep the leading whitespace.\n\nExcellent. These two patches fix my original problem and seem like the\nobviously correct approach (in hindsight ;-) ). I wonder if the diagrams\nearlier in the file should be tackled also. Right now, one has a huge\nnumber of dots instead of the four you added; the other has none. They\ndo render fine though, so that'd only be about consistency in the\noriginal .txt-file.\n"},{"id":"346945","messageId":"20180508011352.GM953644@genre.crustytoothpaste.net","threadId":"48388","inReplyTo":"CAN0heSrth+ZheEsHuVdyUv9fcnP07O=YvK6y+=rmaGqZf7X3_w@mail.gmail.com","subject":"Re: [PATCH 2/2] Documentation: render revisions correctly under Asciidoctor","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-08T01:13:52Z","receivedAt":"2018-05-08T01:14:02Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Mon, May 07, 2018 at 06:11:43AM +0200, Martin Ågren wrote:\n> On 6 May 2018 at 22:42, brian m. carlson <sandals@crustytoothpaste.net> wrote:\n> > When creating a literal block from an indented block without any sort of\n> > delimiters, Asciidoctor strips off all leading whitespace, resulting in\n> > a misrendered chart.  Use an explicit literal block to indicate to\n> > Asciidoctor that we want to keep the leading whitespace.\n> \n> Excellent. These two patches fix my original problem and seem like the\n> obviously correct approach (in hindsight ;-) ). I wonder if the diagrams\n> earlier in the file should be tackled also. Right now, one has a huge\n> number of dots instead of the four you added; the other has none. They\n> do render fine though, so that'd only be about consistency in the\n> original .txt-file.\n\nYeah, the number of dots has to be at least four, but can be any\nmatching number.\n\nSince this patch fixes the present issue, I'd like to leave it as it is\nand run through a cleanup series a bit later that catches all the\nliteral indented blocks and marks them explicitly to avoid this issue in\nthe future.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"347009","messageId":"CAN0heSpaETw_v_a_zL7Cp+cDNHP9je2ZqTHh37FfDHjAbRn18A@mail.gmail.com","threadId":"48388","inReplyTo":"20180508011352.GM953644@genre.crustytoothpaste.net","subject":"Re: [PATCH 2/2] Documentation: render revisions correctly under Asciidoctor","fromName":"Martin Ågren","fromEmail":"martin.agren@gmail.com","sentAt":"2018-05-08T18:31:10Z","receivedAt":"2018-05-08T18:31:16Z","isPatch":true,"sender":{"key":"martin.agren@gmail.com","avatar":null},"body":"On 8 May 2018 at 03:13, brian m. carlson <sandals@crustytoothpaste.net> wrote:\n> On Mon, May 07, 2018 at 06:11:43AM +0200, Martin Ågren wrote:\n>> Excellent. These two patches fix my original problem and seem like the\n>> obviously correct approach (in hindsight ;-) ). I wonder if the diagrams\n>> earlier in the file should be tackled also. Right now, one has a huge\n>> number of dots instead of the four you added; the other has none. They\n>> do render fine though, so that'd only be about consistency in the\n>> original .txt-file.\n>\n> Yeah, the number of dots has to be at least four, but can be any\n> matching number.\n>\n> Since this patch fixes the present issue, I'd like to leave it as it is\n> and run through a cleanup series a bit later that catches all the\n> literal indented blocks and marks them explicitly to avoid this issue in\n> the future.\n\nSounds like a plan. :-) As noted elsewhere, I have no immediate idea how\nto identify which of the 13000 tab-indented lines are really part of\ndiagrams and ascii-art. Counting the number of spaces? Anyway, thanks\nfor this mini-series.\n\nMartin\n"},{"id":"347035","messageId":"20180509002401.GF275488@genre.crustytoothpaste.net","threadId":"48388","inReplyTo":"CAN0heSpaETw_v_a_zL7Cp+cDNHP9je2ZqTHh37FfDHjAbRn18A@mail.gmail.com","subject":"Re: [PATCH 2/2] Documentation: render revisions correctly under Asciidoctor","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2018-05-09T00:24:02Z","receivedAt":"2018-05-09T00:24:10Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Tue, May 08, 2018 at 08:31:10PM +0200, Martin Ågren wrote:\n> On 8 May 2018 at 03:13, brian m. carlson <sandals@crustytoothpaste.net> wrote:\n> > Since this patch fixes the present issue, I'd like to leave it as it is\n> > and run through a cleanup series a bit later that catches all the\n> > literal indented blocks and marks them explicitly to avoid this issue in\n> > the future.\n> \n> Sounds like a plan. :-) As noted elsewhere, I have no immediate idea how\n> to identify which of the 13000 tab-indented lines are really part of\n> diagrams and ascii-art. Counting the number of spaces? Anyway, thanks\n> for this mini-series.\n\nI have an utterly terrible Ruby one-liner which I wrote in a few\nminutes.  It has some false positives, but not enough that I'd mind\nsorting through them.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"}]}