emacs 的 Egg git 接口,提交消息为空
我使用egg(emacs有git)作为emacs中的git接口。 每当我尝试实现提交 --amend 时,我都会收到 “GIT-COMMIT-AMEND> 由于空提交消息而中止提交”。
这就是我所做的:
C-u C-x v c
然后出现提交缓冲区,并带有我之前提交的消息。
然后,在抄送
后,我收到上述消息:空提交消息。
我想我以前在常规提交中也遇到过这种行为(如不修改),但不记得或找不到我是如何解决它的。
我尝试编辑该消息(在某处添加空格)。没有工作。
我尝试在提交之前保存缓冲区,但这也不起作用(因为 Cc Cc
在提交缓冲区之外的另一个缓冲区中不处于活动状态)。
有什么线索吗?
I'm using egg (emacs got git) as git interface in emacs.
Whenever I try to achieve a commit --amend, I receive a "GIT-COMMIT-AMEND> Aborting commit due to empty commit message".
This is what i do:
C-u C-x v c
Then the commit buffer appears, with the message of my previous commit.
Then upon C-c C-c
I get the message stated above: empty commit message.
I think I've had this behaviour with regular commits (as in not amend) before, but can't remember or find how I solved it.
I tried editing the message (adding a space somewhere). No work.
I tried saving the buffer before committing, that wouldn't work either (since C-c C-c
is not active in another buffer than the commit buffer).
Any clue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这是因为 emacs 尝试打开编辑器进行 commit --amend 吗?请参阅此交流
Is this because of the editor emacs try to open for a
commit --amend
? See this exchange问题解决了,虽然不太明白。
我不得不改变鸡蛋的一些选项。在某些情况下,它似乎没有正确的字符串来查找 git.exe。
我做了什么:
然后将
Egg git 命令
更改为git.exe
包括其完整路径。这有点奇怪,因为:
在学习了如何调试 elisp 后,我发现在函数
egg-log-msg-commit
中,应该显示提交消息限制的标记都是nil
。在其他地方,这些标记保存提交消息的字符索引,但不在那里。
Problem solved, although I do not quite understand.
I had to change some options for egg. It didn't seem to have the correct string to find
git.exe
in some cases.What I did:
then changing
Egg git command
togit.exe
including its full path worked.This is a bit strange since:
After learning how to debug elisp, I found that the markers supposed to show the limits of the commit message were both
nil
in the functionegg-log-msg-commit
.At other places, these markers hold the character indexes for the commit message, but not there.
我只是尝试使用 PsPad 作为提交编辑器,但没有成功。它失败并出现相同的错误消息。这里的问题是 git 像这样调用它的编辑器:
但是 PsPad 无法使用“/”解析该路径,这导致 PsPad 在存储库根文件夹中而不是在子文件夹“.git”中打开文件 COMMIT_EDITMSG 。
我不使用 emacs/egg 所以我无法重现你的问题,但也许这些信息也有帮助。
对于 PsPad 用户:我通过使用此包装脚本调用 PsPad 解决了我的问题:
该代码行包含在用作 git 编辑器的批处理文件中。它只是用“\”替换所有“/”,这使得 PsPad 被这样调用:
I just tried to use PsPad as commit editor which didn't work. It failed with the same error message. The problem here is that git calls its editor like that:
But PsPad isn't able to parse that path with a '/', which results in PsPad opening a file COMMIT_EDITMSG in the repository root folder rather than in the subfolder '.git'.
I don't use emacs/egg so I cannot reproduce your problem, but maybe that information also helps.
For PsPad users: I solved my problem by using this wrapper script to call PsPad:
That code line is contained in a batch file which is used as git editor. It simply replaces all '/' by '\', which makes PsPad being called like that:
我在 Windows 上使用 MSYS git。设置实际 git.exe 的路径为我解决了这个问题。 (对我来说,正确的路径是:'c:\Program Files\Git\bin\git.exe')。
默认情况下,MSYS git 添加到路径 git.cmd,这显然会猜测 git.exe 的位置等。我认为这不知何故弄乱了与 emacs 的连接。
编辑:上述方法有一个缺陷。 git.cmd 显然设置了 home 环境变量。一些 git 设置写在那里。当与 emacs 一起使用时,git.exe 将从 emacs 接收环境。因此,建议确保 git 从命令行执行时具有与 emacs 相同的主目录。
我个人通过在启动期间更改 HOME 环境变量在 emacs 配置中修复了此问题,但这会产生一些副作用,例如编辑 .emacs 文件。
I'm using the MSYS git on Windows. Setting the path to the actual
git.exe
fixed this issue for me. (For me the correct path was: 'c:\Program Files\Git\bin\git.exe').By default MSYS git adds to the path git.cmd, which will apparently guess the location of the git.exe, among other things. Somehow this messes up the connection with the emacs, I think.
EDIT: There is one flaw in the approach above. The git.cmd apparently sets up home environment variable. Some of the git settings are written there. When used with emacs, the git.exe will receive the environment from emacs. So, it would be advisable to make sure that git, when executed from command line, has the same home dir as emacs.
I've personally fixed this in emacs config by changing the HOME environment variable during the start-up, but this has some side effects regarding, e.g., editing your .emacs file.