如何让VS Code的Commit UI在提交消息中支持“#”?

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

这不是Start a git commit message with a hashmark (#)的副本,因为我了解commentchar,并且已经将git配置为使用其他注释字符了:3> >

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的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不允许我提交(单击提交按钮时什么也没有发生),并且 Command Palette > Git:Commit 命令只会中止提交(可能是因为它被视为空的提交消息。

如何获取VS Code来识别自定义commentchar设置?

注意:

  • 我知道VS Code使用我的git config(全局或本地),因为当我尝试更改其他设置(例如user.name)时,它会正确应用
  • 它不是Start a git commit message with a hashmark (#)的副本,因为我说的是通过VS Code的Commit UI而不是通过命令行提交
  • 我找不到与提交消息相关的VS Code> Git设置
  • 我正在使用VS Code 1.40.0
feidaokuan2 回答:如何让VS Code的Commit UI在提交消息中支持“#”?

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

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

  

针对#6403的修复使得输入框现在开始处理行   #作为注释。

然后将其“修复”为VS Code的 1.40.1 版本的一部分。
更新1.40.1 :此更新解决了这些issues。)

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

  

您应该能够以#和   然后是任何内容。

     

您应该能够提交以#开头的行的消息   后跟数字。以#开头且后面没有数字的行   将被注释掉。例如,以下提交消息:

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

应成为:

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

由于所有其他行都应被注释掉。

我之所以说“已修复”,是因为在有关Github问题的讨论中,“提交UI”输入框似乎并没有完全遵循或使用git的commentchar配置,并且具有自己解析提交消息的哪些部分是注释。

在我的情况下,由于我的提交消息采用“ #开头的单行,然后是任何内容”的格式,因此似乎可行。但是,如果您使用的其他格式不适合输入框的正则表达式规则,那么它将无法正常工作。

本文链接:https://www.f2er.com/3109600.html

大家都在问