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

Re: [PATCH 83/83] builtin/am: use apply api in run_apply()

From
Christian Couder <christian.couder@gmail.com>
Date
May 5, 2016, 10:04 UTC
Message-ID
<CAP8UFD22kGGH9W62Mzoc2h+fbtGRP5vGofAauAhdBP8R5bja_Q@mail.gmail.com>
In-Reply-To
<alpine.DEB.2.20.1604251701180.2896@virtualbox>
Hi Dscho,

On Mon, Apr 25, 2016 at 5:03 PM, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 20 quoted lines
> Hi Chris,
>
> On Sun, 24 Apr 2016, Christian Couder wrote:
>
>> [...]
>>       /*
>>        * If we are allowed to fall back on 3-way merge, don't give false
>>        * errors during the initial attempt.
>>        */
>> +
>>       if (state->threeway && !index_file) {
>> -             cp.no_stdout = 1;
>> -             cp.no_stderr = 1;
>> +             save_stdout_fd = dup(1);
>> +             dup_devnull(1);
>> +             save_stderr_fd = dup(2);
>> +             dup_devnull(2);
>
> I wonder. It should be possible to teach the apply function to be quiet by
> default, yes? That would be more elegant than dup()ing back and forth.

Yes, it could be possible, but it could mean many changes not only in the apply functions, but in possibly many other places as well. I didn't check, but for example if an apply function calls a function from another part of git and this function uses error(...) in case of error, I would have to change this function too.

I could also introduce a hack like a global variable that would tell error() to shut up, but I am not sure that would be more elegant.

Thanks, Christian.

Previous: Johannes SchindelinNext: Johannes Schindelin
Message 12 of 24 in “run-command: make dup_devnull() non static”
  1. 80/83 run-command: make dup_devnull() non staticChristian Couder, Apr 24, 2016
  2. 81/83 apply: roll back index in case of errorChristian Couder, Apr 24, 2016
  3. Johannes SchindelinApr 25, 2016
  4. Johannes SchindelinMay 2, 2016
  5. Eric SunshineMay 2, 2016
  6. Christian CouderMay 3, 2016
  7. 82/83 environment: add set_index_file()Christian Couder, Apr 24, 2016
  8. Junio C HamanoMay 3, 2016
  9. Christian CouderMay 4, 2016
  10. 83/83 builtin/am: use apply api in run_apply()Christian Couder, Apr 24, 2016
  11. Johannes SchindelinApr 25, 2016
  12. Christian CouderMay 5, 2016
  13. Johannes SchindelinApr 25, 2016
  14. Christian CouderMay 5, 2016
  15. Johannes SixtMay 5, 2016
  16. Christian CouderMay 6, 2016
  17. Johannes SchindelinMay 6, 2016
  18. Christian CouderMay 7, 2016
  19. Johannes SchindelinMay 7, 2016
  20. Christian CouderMay 7, 2016
  21. Johannes SchindelinMay 8, 2016
  22. Duy NguyenMay 8, 2016
  23. Johannes SchindelinMay 9, 2016
  24. Junio C HamanoMay 9, 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.