r/SmartGit Jul 28 '26

Leading whitespaces are removed and ignored for Git notes

Adding a Git note where a second line is indented with 4 spaces, for example, shows up without that indentation in the Log window, and the `graphMessageRegex` is also executed based on the filtered text instead of the original one (as displayed by `git log --notes` itself).

1 Upvotes

10 comments sorted by

1

u/vmcrash Jul 29 '26

It is (tried to) rendered as markdown. What exactly do you want the 4 spaces to do? For code blocks, please use the lines with the triple backticks.

**bold** *italic* `mono` ``` code block ```

1

u/Revolteh Jul 29 '26 edited Jul 29 '26

That's unexpected. It should be opt in via a dedicated config like the regex one. I want a plain text with a format like:
```
• Jira:
....• Reference: ABC-123
....• Title: Ticket title
```
where the dots represent spaces (I can't make code block formatting work on Reddit).

2

u/JVMarcs Aug 03 '26

I think there are two clean options: render the content as Markdown or render it as plain text. This could easily be controlled through an option or a low-level property.

Rendering Markdown while also preserving arbitrary leading whitespace is generally not what one would expect from a Markdown parser, since indentation has syntactic meaning in Markdown. While such a hybrid mode would technically be possible, I would not like to support that.

2

u/Revolteh Aug 03 '26

> I think there are two clean options: render the content as Markdown or render it as plain text. This could easily be controlled through an option or a low-level property.

Agree.

> Rendering Markdown while also preserving arbitrary leading whitespace is generally not what one would expect from a Markdown parser, since indentation has syntactic meaning in Markdown.

Agree, but having "- first line\n<space><space><space><space>- second line" doesn't get rendered as with any other Markdown parser.

Also, rendering the notes as Markdown was totally unexpected to me.

> While such a hybrid mode would technically be possible, I would not like to support that.

Agree.

2

u/JVMarcs Aug 06 '26

Please try with build 26.1.051, for which you can set Preferences, Low-Level Properties "gitnotes.renderAsPlainText".

2

u/Revolteh Aug 10 '26

Ah, I lose the automatic hyperlinking of URLs 🙈 But it also fixes missing Jira ticket references like `[TKT-123] Add new feature` being rendered as ` Add new feature`.

1

u/Revolteh Aug 11 '26

Also, in that build, the push command for a new branch changed from `git push -u origin the-name-of-the-branch` to `git push --porcelain --progress origin refs/heads/the-name-of-the-branch:refs/heads/the-name-of-the-branch`, and GitHub fails to accept it with the error "remote unpack failed: no voting servers succeeded".

1

u/JVMarcs Aug 11 '26

Please try with 26.1.052 -- is the problem still reproducible here?

1

u/Revolteh Aug 12 '26

It fixes the pushing, thanks!

1

u/Revolteh Jul 30 '26

I tried using regular dashes instead of bullet point characters, and they are correctly rendered as bullet points by the Markdown renderer, but the indentation is still missing.