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?
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:
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.
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.
Is this because of the editor emacs try to open for a
commit --amend
? See this exchange