"->" vs "→" in a commit message

Contributing guide says:

Format the commit messages in the following way:

(pkg-name | nixos/<module>): (from -> to | init at version | refactor | etc)

(Motivation for change. Additional information.)

I see many maintainers (and core committers) use unicode char “→” instead of “->”:

$ git log --all --grep='→' | wc -l
15389
$ git log --all --grep='->' | wc -l
859570

But another part of committers requires to use only “->” in PRs.
What do you think about it? Is it acceptable to use “→” along with “->”?

2 Likes

I would not want to force anyone to use the Unicode arrow but personally, I hate using the ASCII counterpart because the hyphen does not align with the tip of the greater than sign in many fonts.

Unicode is widely supported these days and both variants are almost equivalent visually so I see no reason to avoid arrow characters. The only argument against it I heard is that it makes parsing commit messages harder but that is just a one time cost for each tool.

5 Likes

I enjoy playing Agda, where lavish use of Unicode symbols is commonplace. After a transitional period of reluctance (shouldn’t ASCII be everything we need?), I fully embraced the Unicode way of living and love that the optical appearance now closer aligns with the beauty of the theoretical concepts.

In other words, for what it’s worth, I’d support a gradual switch to “→”. After echo keycode 135 = Multi_key | xmodmap -, this symbol is just a simple <Menu> - > away.

1 Like

If it is used it might be good to include a note in the CONTRIBUTING.md guidelines.

I also prefer unicode right arrow over legacy ASCII right arrow.

Also, @sikmir, took your comparison and made a small tweak to only include the title by using the oneline pretty format which is [commit hash] [commit title].

It should remove false positives from arrows inside the commit message and wc -l now would count the number of commits.

git log origin/master --grep='→' --pretty=oneline | wc -l   1988ms  Sun 17 Oct 2021 09:57:07 AM CDT
2520

vs

git log origin/master --grep='->' --pretty=oneline | wc -l  1999ms  Sun 17 Oct 2021 09:57:10 AM CDT
122402