{"thread":{"id":"24843","subject":"Why does git-mergetool use /dev/tty?","startedAt":"2010-08-24T01:49:57Z","lastAt":"2010-08-24T07:04:38Z","messageCount":5,"participants":["Brian Gernhardt","Jonathan Nieder","Charles Bailey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"148801","messageId":"3D6C7B12-FA06-4EAD-9781-5CA74FE23057@gernhardtsoftware.com","threadId":"24843","inReplyTo":null,"subject":"Why does git-mergetool use /dev/tty?","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2010-08-24T01:49:57Z","receivedAt":"2010-08-24T01:49:57Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"git-mergetool.sh, lines 298-302:\n>     if test $last_status -ne 0; then\n>         prompt_after_failed_merge < /dev/tty || exit 1\n>     fi\n>     printf \"\\n\"\n>     merge_file \"$i\" < /dev/tty > /dev/tty\n\nWhy does git-mergetool ignore the provided STDIN and STDOUT when not given a path to merge?\n\nThis wasn't apparent until bb0a484: \"mergetool: Skip autoresolved paths\" added a test that doesn't provide a file to merge on the command line.\n\n~~ Brian Gernhardt"},{"id":"148802","messageId":"20100824015337.GC17406@burratino","threadId":"24843","inReplyTo":"3D6C7B12-FA06-4EAD-9781-5CA74FE23057@gernhardtsoftware.com","subject":"Re: Why does git-mergetool use /dev/tty?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-24T01:53:37Z","receivedAt":"2010-08-24T01:53:37Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brian Gernhardt wrote:\n\n> Why does git-mergetool ignore the provided STDIN and STDOUT when not given a path to merge?\n\nSee af314714 (mergetool: Remove explicit references to /dev/tty,\n2010-08-20) in pu.\n\nHope that helps,\nJonathan\n"},{"id":"148803","messageId":"D4C0AFB5-EC8C-44B6-9280-9915DE224CB6@gernhardtsoftware.com","threadId":"24843","inReplyTo":"20100824015337.GC17406@burratino","subject":"Re: Why does git-mergetool use /dev/tty?","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2010-08-24T01:58:23Z","receivedAt":"2010-08-24T01:58:23Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"\nOn Aug 23, 2010, at 9:53 PM, Jonathan Nieder wrote:\n\n> Brian Gernhardt wrote:\n> \n>> Why does git-mergetool ignore the provided STDIN and STDOUT when not given a path to merge?\n> \n> See af314714 (mergetool: Remove explicit references to /dev/tty,\n> 2010-08-20) in pu.\n> \n> Hope that helps,\n\nIt does really help, actually.  One thing removed from my TODO.\n\n~~ Brian\n"},{"id":"148823","messageId":"20100824064306.GA18308@hashpling.org","threadId":"24843","inReplyTo":"3D6C7B12-FA06-4EAD-9781-5CA74FE23057@gernhardtsoftware.com","subject":"Re: Why does git-mergetool use /dev/tty?","fromName":"Charles Bailey","fromEmail":"charles@hashpling.org","sentAt":"2010-08-24T06:43:06Z","receivedAt":"2010-08-24T06:43:06Z","isPatch":false,"sender":{"key":"charles@hashpling.org","avatar":"https://avatars.githubusercontent.com/u/1668475?v=4"},"body":"On Mon, Aug 23, 2010 at 09:49:57PM -0400, Brian Gernhardt wrote:\n> git-mergetool.sh, lines 298-302:\n> >     if test $last_status -ne 0; then\n> >         prompt_after_failed_merge < /dev/tty || exit 1\n> >     fi\n> >     printf \"\\n\"\n> >     merge_file \"$i\" < /dev/tty > /dev/tty\n> \n> Why does git-mergetool ignore the provided STDIN and STDOUT when not given a path to merge?\n\nIt doesn't deliberately ignore them, it merely loses them because what\nyou've quoted is in the middle of a redirect, you snipped:\n\n    files_to_merge |\n    while IFS= read i\n    do  \n\nmergetool is designed to be an interactive tool and didn't originally\nhave any tests so this was a reasonable (if ugly) way to restore\naccess to the user for the merge_file function.\n\nThis is also why all the previous test provided an explict list of\nfiles to merge, because this was the only testable way to invoke\nmergetool.\n\nThere's a proposed patch to save and restore the original stdin\ninstead of assuming that there is a tty in pu: af314714.\n\nIf the current behaviour is causing an issue for you then testing this\nfix would be appreciated.\n\nThanks,\n\nCharles.\n"},{"id":"148826","messageId":"4323106E-D314-4644-8203-71CC3811A962@gernhardtsoftware.com","threadId":"24843","inReplyTo":"20100824064306.GA18308@hashpling.org","subject":"Re: Why does git-mergetool use /dev/tty?","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2010-08-24T07:04:38Z","receivedAt":"2010-08-24T07:04:38Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"\nOn Aug 24, 2010, at 2:43 AM, Charles Bailey wrote:\n\n> There's a proposed patch to save and restore the original stdin\n> instead of assuming that there is a tty in pu: af314714.\n> \n> If the current behaviour is causing an issue for you then testing this\n> fix would be appreciated.\n\nThe issue was spurious output during tests, which is fixed by af314714.\n\nThanks for the explanation though, I had missed that it was part of a pipeline.\n\n~~ Brian\n"}]}