如何让 VS Code 的 Commit UI 在提交信息中支持一个`#`?

How to let VS Code's Commit UI support a `#` in the commit message?

我需要遵循以 # 开头的 git 提交消息格式(例如 #1234 ...)。

不是 Start a git commit message with a hashmark (#) 的副本,因为我知道 commentchar 并且我已经将 git 配置为使用不同的评论字符:

gino@myrepo$ git config --global --get core.commentchar
;
gino@myrepo$ git config --get core.commentchar
;

我还确认如果我从命令行提交它是有效的:

gino@myrepo$ git log
Author: ...
Date:   Wed Nov 13 21:59:40 2019 +0900

    # Test `git commit` from terminal
    # These 2 lines should not be treated as comments

问题是当我尝试从 VS Code's Commit UI:

进行提交时

VS Code 的 Git 似乎不支持 # 不是注释的配置,因为当我检查 git log 时,它只显示第二行:

gino@myrepo$ git log
commit 1254416d309588293372b96fd1f71e30af51b1fe (HEAD -> master)
Author: ...
Date:   Wed Nov 13 22:23:17 2019 +0900

    These lines should be details.

当我尝试使用单行消息时情况更糟 (#4567: blah)。提交 UI 不允许我提交(当我点击提交按钮时没有任何反应)和 命令面板 > Git: Commit 命令将简单地中止提交(可能是因为它被视为空提交消息)。

如何让 VS Code 识别自定义 commentchar 设置?

备注:

这显然是 1.40.0 版本的 VS Code 的回归错误。
(感谢 指出相关的 Github 问题。)

https://github.com/microsoft/vscode/issues/84201#issuecomment-552830865:

The fix for #6403 made it that the input box now treats lines starting with # as comments.

当时 "fixed" 作为 VS Code 1.40.1 版本的一部分。
更新 1.40.1:更新解决了这些 issues。)

https://github.com/microsoft/vscode/issues/84201#issuecomment-552840563

You should be able to commit a single line starting with # and followed by any contents.

You should be able to commit messages with lines starting with # followed by digits. Lines starting with # and not followed by digits will be commented out. For example, the following commit message:

first line
second line
#third line
# fourth line
# 5th line
#6th line
#7 th line
#8

Should become:

first line
second line
#6th line
#7 th line
#8

Since all other lines should be commented out.

我说 "fixed" 是因为从 Github 问题的讨论来看, Commit UI 输入框似乎 不完全 遵循或使用 git 的 commentchar 配置,并且它对提交消息的哪些部分是评论有自己的解析。

在我的例子中,由于我的提交消息遵循格式“单行以 # 开头,后跟任何内容 ”,所以它似乎是有效的。但是,如果您使用的是不符合输入框正则表达式规则的不同格式,那么它将无法正常工作。