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

Re: [PATCH] mergetool: Remove explicit references to /dev/tty

From
Charles Bailey <charles@hashpling.org>
Date
Aug 20, 2010, 13:50 UTC
Message-ID
<4C6E883A.2030301@hashpling.org>
In-Reply-To
<20100820122724.GS10407@burratino>
On 20/08/2010 13:27, Jonathan Nieder wrote:
Show 12 quoted lines
>> +++ b/git-mergetool.sh
>> @@ -292,14 +292,15 @@ if test $# -eq 0 ; then
>>       printf "Merging:\n"
>>       printf "$files\n"
>>
>> -    files_to_merge |
>> +    # Save original stdin to fd 3
>> +    files_to_merge 3<&0 |
>
> I would think this should work, but it doesn't feel idiomatic.  Why
> not save stdin a little earlier, so the reader does not have to track
> down whether it has been redirected?

No special reason, I just thought it was more natural to save it at the time that we do the redirect..

> The test quietly passes for me with dash but fails with ksh:
>
>   /home/jrn/src/git4/git-mergetool: line 303: 3: cannot open [Bad file descriptor]

... but given that this approach is evidently less portable your way is clearly better.

> With the patch below on top, it passes with dash and ksh.
Thanks, I'll re-roll in a bit at squash your fixes in, if that's OK?
Charles.
Previous: Jonathan NiederNext: Jonathan Nieder
Message 14 of 16 in “Status of conflicted files resolved with rerere”
  1. Magnus BäckAug 12, 2010
  2. Avery PennarunAug 12, 2010
  3. Jay SoffianAug 13, 2010
  4. David AguilarAug 15, 2010
  5. Junio C HamanoAug 15, 2010
  6. Magnus BäckAug 15, 2010
  7. mergetool: Skip autoresolved pathsDavid Aguilar, Aug 17, 2010
  8. Thomas RastAug 19, 2010
  9. David AguilarAug 20, 2010
  10. Charles BaileyAug 20, 2010
  11. Jonathan NiederAug 20, 2010
  12. mergetool: Remove explicit references to /dev/ttyCharles Bailey, Aug 20, 2010
  13. Jonathan NiederAug 20, 2010
  14. Charles BaileyAug 20, 2010
  15. Jonathan NiederAug 20, 2010
  16. mergetool: Remove explicit references to /dev/ttyCharles Bailey, Aug 20, 2010

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.