Re: git difftool and git mergetool aren't returning errors when the tool has issues
- From
John Keeping <john@keeping.me.uk>
- Date
- Aug 13, 2016, 10:36 UTC
- Message-ID
- <20160813103639.mxscvfyztee4hbvh@john.keeping.me.uk>
- In-Reply-To
- <57AD772501C207A400390148_0_15304@p057>
On Fri, Aug 12, 2016 at 07:13:41AM -0000, Tom Tanner (BLOOMBERG/ LONDON) wrote:
Show 13 quoted lines
> For instance, if you set your diff/mergetool to meld and you don't have it installed: > > git difftool > > Viewing (1/1): 'blah' > Launch 'meld' [Y/n]? y > /home/ttanner/bin/meld[8]: /opt/swt/bin/meld: not found > > echo $? > 0 > > > /home/ttanner/bin/meld > /home/ttanner/bin/meld[8]: /opt/swt/bin/meld: not found > > echo $? > 127
Have you looked at the --trust-exit-code option to git-difftool?
It would be nice if there was a way to differentiate between complete failure and just the diff tool exiting with a non-zero return status because the files differ, but I'm not sure whether we can do that reliably. POSIX uses 127 and 126 as errors that mean the command didn't run [1] so it may be sensible to to treat those as special values.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_08_02