Git 提交不接受摘要

Git commit doesn't accept summary

所以我最近克隆了 gnu-coreutils 以查看我使用的程序实际如何工作,并更加熟悉 git,尤其是 git 的 CLI。但是,当我尝试使用带有描述 basename: some-descgit commit src/basename.c 提交对 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

此描述遵循存储库中包含的“HACKING”文件的指南:

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 作为程序名称。 catbase64chcon 等其他程序的名称仍然有效,所以也许这只是一个错误?

我也尝试用谷歌搜索这个问题,但除了关于如何格式化 git 提交消息的一般指南外,我找不到任何东西。

coreutils 存储库 sets up Git hooks in your local clone of the repository. You can find the commit message check in scripts/git-hooks/commit-msg

每次尝试提交时都是 运行。它定义了允许的关键字,从 line 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在其中。

要暂时禁用 运行ning 提交挂钩,请在提交期间指定 --no-verify


编辑:我已经向 coreutils 项目提交了一个补丁来修复这个错字:https://lists.gnu.org/archive/html/coreutils/2022-01/msg00013.html。让我们看看:)


编辑:这已经在提交 95ec19ecbd125598f047a938882f5bba81f0e9a3

时修复