git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Tom Tanner (BLOOMBERG/ LONDON)Next: John Keeping
Message 2 of 5 in “git difftool and git mergetool aren't returning errors when the tool has issues”
  1. Tom Tanner (BLOOMBERG/ LONDON)Aug 12, 2016
  2. John KeepingAug 13, 2016
  3. difftool: always honor "command not found" exit codeJohn Keeping, Aug 13, 2016
  4. Junio C HamanoAug 14, 2016
  5. David AguilarAug 13, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.