Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make git work with vimdiff and trustExitCode

Tags:

git

mergetool

I have configured vimdiff as mergetool for git. Whenever i do a merge, git never asks wether the merge was successful. I also tried:

git config --global mergetool.vimdiff.trustExitCode false

with no difference. Still no question after i leave vimdiff with :wqa and i have to manually remove stale *.orig files.

Maybe related: When i display config settings trustExitCode is not displayed with camelcase anymore:

git config --global -l

core.editor=vim
core.autocrlf=input
merge.tool=vimdiff
alias.co=checkout
alias.st=status
color.diff=auto
color.status=auto
color.branch=auto
mergetool.vimdiff.trustexitcode=false

How can this be fixed?

like image 606
Michael Härtl Avatar asked Jan 20 '23 15:01

Michael Härtl


1 Answers

I know this is an old question, but I just ran into the same issue.

The part about manually removing stale backup files can be fixed with:

git config --global mergetool.vimdiff.keepBackup false

I think other problem is that trustExitCode doesn't do what you think it does:

mergetool.<tool>.trustExitCode

For a custom merge command, specify whether the exit code of the merge command can be used to determine whether the merge was successful. If this is not set to true then the merge target file timestamp is checked and the merge assumed to have been successful if the file has been updated, otherwise the user is prompted to indicate the success of the merge.

So, even with this option set to false, it will only prompt you if the file hasn't been changed.

like image 85
xthrd Avatar answered Jan 27 '23 05:01

xthrd