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

Re: [PATCH v6 3/5] difftool: avoid returning -1 to cmd_main() from run_dir_diff()

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 1, 2021, 00:12 UTC
Message-ID
<xmqqmtnt8uxl.fsf@gitster.g>
In-Reply-To
<CAJDDKr41qzbUudAHgokRARK-kEG4araFwJ0UhLmJ4Pca=xFZRA@mail.gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 9 quoted lines
>> Among them, the return value from run_command_v_opt() eventually
>> come from wait_or_whine(), I think, so it may be generic -1 or
>> it may be WEXITSTATUS() of the child process.
>>
>> But I am not sure if this particular caller cares.  It is not
>
> The property I was trying to maintain is that we would forward the result
> from the child process in most situations, so we should try and forward
> the result from run_command_v_opt() whenever possible.

Oh, if it were the case, then I agree that !!ret would not be sufficient.

I just had an impression that this particular caller of the run_command_v_opt() did not care, as it did not special case -1 returned from the function as different from what came from WEXITSTATUS().

> That suggests that Ævar's sug is better...
>
>     return (ret < 0) ? 1 : ret;

Yup, that would work, as long as exit status 1 from the external diff tool is not all that special (in which case, we cannot tell it from 1 that came from ret = error()).

Thanks.
Previous: David AguilarNext: David Aguilar
Message 6 of 11 in “difftool: create a tmpdir path without repeated slashes”
  1. 1/5 difftool: create a tmpdir path without repeated slashesDavid Aguilar, Sep 30, 2021
  2. 2/5 difftool: add a missing space to the run_dir_diff() commentsDavid Aguilar, Sep 30, 2021
  3. 3/5 difftool: avoid returning -1 to cmd_main() from run_dir_diff()David Aguilar, Sep 30, 2021
  4. Junio C HamanoSep 30, 2021
  5. David AguilarSep 30, 2021
  6. Junio C HamanoOct 1, 2021
  7. 4/5 difftool: refactor dir-diff to write files using a helper functionDavid Aguilar, Sep 30, 2021
  8. Junio C HamanoSep 30, 2021
  9. David AguilarSep 30, 2021
  10. 5/5 difftool: remove an unnecessary call to strbuf_release()David Aguilar, Sep 30, 2021
  11. Junio C HamanoSep 30, 2021

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.