因此,我最近克隆了gnu-coreutils,以了解我使用的程序是如何工作的,并且更加熟悉git,特别是git的CLI。但是,当我尝试通过使用git commit src/basename.c和description basename: some-desc对basename.c进行更改时,它返回了错误
commit-msg: invalid first word(s) of summary line: basename
Interrupt (Ctrl-C) to abort...
Too many errors from stdin
commit-msg: .git/COMMIT_EDITMSG: the editor (editor) failed, aborting本说明遵循存储库中包含的“黑客”文件中的指导方针:
Try to make the summary line fit one of the following forms:
program_name: change-description
prog1, prog2: change-description
doc: change-description
tests: change-description
build: change-description
maint: change-description但是git仍然不接受basename作为程序名称。但是,像cat、base64和chcon这样的其他程序的名称可以工作,所以也许这只是一个bug?
我也尝试搜索这个问题,但是除了关于如何格式化git提交消息的一般指导原则之外,我什么也找不到。
发布于 2022-01-02 14:56:26
在存储库的本地克隆中,coreutils存储库架设 Git 钩子。您可以在scripts/git-hooks/commit-msg中找到提交消息检查。
它在每次尝试提交时都会运行。它定义了从第14行开始的允许关键字
# Keywords allowed before the colon on the first line of a commit message:
# program names and a few general category names.
my @valid = qw(
arch b2sum base32 base64 basenc nbasename cat chcon chgrp chmod chown
chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo
env expand expr factor false fmt fold groups head hostid hostname id
install join kill link ln logname ls md5sum mkdir mkfifo mknod mktemp
mv nice nl nohup nproc numfmt od paste pathchk pinky pr printenv printf
ptx pwd readlink realpath rm rmdir runcon seq sha1sum sha224sum sha256sum
sha384sum sha512sum shred shuf sleep sort split stat stdbuf stty
sum sync tac tail tee test timeout touch tr true truncate tsort
tty uname unexpand uniq unlink uptime users vdir wc who whoami yes
all copy gnulib tests maint doc build scripts sha\*sum digest
);basename不在其中,但nbasename在其中。
若要暂时禁用运行提交挂钩,请在提交期间指定--no-verify。
编辑:我已经向coreutils项目提交了一个补丁来修复这个错误:https://lists.gnu.org/archive/html/coreutils/2022-01/msg00013.html。(让我们看看:)
编辑:从提交95ec19ecbd125598f047a938882f5bba81f0e9a3开始,这个问题就已经解决了
https://stackoverflow.com/questions/70556934
复制相似问题