500 errors when opening a file or the commit list when mailmap is used.
Symptoms
When the repository has a .mailmap
file in its root directory, opening the commit list or a file fails with a 500 error. Additionally, the following appears in the atlassian-stash.log
:
on Linux or Mac OS:
An error occurred while executing an external process: '/usr/bin/git rev-list --format=%H%x02%h%x02%P%x02%p%x02%aN%x02%aE%x02%at%n%B%n%x03 -1 refs/heads/master -- mailmap' exited with code 139 com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: '/usr/bin/git rev-list --format=%H%x02%h%x02%P%x02%p%x02%aN%x02%aE%x02%at%n%B%n%x03 -1 refs/heads/master -- mailmap' exited with code 139 at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120) ~[na:na] at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.onError(GitCommandExitHandler.java:163) ~[na:na]
or on Windows:
An error occurred while executing an external process: 'C:\Program Files (x86)\Git\cmd\git.exe rev-list --format=%H%x02%h%x02%P%x02%p%x02%aN%x02%aE%x02%at%n%B%n%x03 -1 refs/heads/master -- .mailmap' exited with code 255 com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: 'C:\Program Files (x86)\Git\cmd\git.exe rev-list --format=%H%x02%h%x02%P%x02%p%x02%aN%x02%aE%x02%at%n%B%n%x03 -1 refs/heads/master -- .mailmap' exited with code 255 at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120) ~[na:na] at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.onError(GitCommandExitHandler.java:163) ~[na:na]
Cause
This is related to a bug in Git from 1.8.2 to 1.8.4 (on Linux or Windows), which is described in more details in STASH-3891.
Workaround
Either:
- to fix the issue on all the repositories hosted in Stash, downgrade to a version of Git or msysgit prior to 1.8.2.
or, to fix the issue only for the current repository, edit the
.mailmap
on the repository's default branch (usuallymaster
) to include a newline at the end of the file, then commit and push the change to Stash:$ git fetch origin $ git checkout origin/master $ echo -e "\n" >> .mailmap $ git commit -m"fix .mailmap line ending" -- .mailmap $ git push origin HEAD:master