{"thread":{"id":"33170","subject":"Suggestion for difftool behaviour during a merge conflict","startedAt":"2013-03-13T18:48:59Z","lastAt":"2013-03-13T22:26:03Z","messageCount":2,"participants":["Øystein Walle","David Aguilar"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"211242","messageId":"CAFaJEqu8gHSLK5u7v5ZOaJ1XjAhV=F9p46MEo2sDVH4vpXAojA@mail.gmail.com","threadId":"33170","inReplyTo":null,"subject":"Suggestion for difftool behaviour during a merge conflict","fromName":"Øystein Walle","fromEmail":"oystwa@gmail.com","sentAt":"2013-03-13T18:48:59Z","receivedAt":"2013-03-13T18:48:59Z","isPatch":false,"sender":{"key":"oystwa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/794585?v=4"},"body":"When a merge is ongoing and there are conflicts, 'git difftool' will\noutput the exact same --cc-style diff output as 'git diff' will without\nfurther explanation. This has lead to some confusion: A couple of weeks\nago a person asked on #git why his difftool wasn't working. After a long\nwhile we realized difftool's behaviour after invocations such as 'git\ndifftool HEAD~ HEAD' would work as expected but 'git difftool' \"simply\nwouldn't\".\n\nWith that in mind I have three suggestions on improving 'git difftool':\n\n - Show a three-way diff between the versions (local, remote, merge)\n   using the user's configured difftool. Diffing against the version\n   containing the markers will generate some extra noise in the difftool\n   and might be confusing, but it's similar in behaviour to how 'git\n   difftool' normally works.\n\n - Prompt the user if they want to launch 'git mergetool' instead since\n   a merge is ongoing. Reasonable but it might be awkward if the user is\n   asked whether the conflict was resolved or not when all they wanted\n   to do was to visually diff something.\n\n - Add a notice to stderr saying that a --cc-style diff output is shown\n   instead; or document the behaviour in the man page. Definitely the\n   simplest option.\n\nI'm willing to try to take a stab at either of these but I wanted to\nbring it up first. There is of course an implicit fourth option which is\nto do nothing, and that I'm wrong about this :)\n\nBest regards,\nØystein Walle\n"},{"id":"211256","messageId":"CAJDDKr4OLmkPmXA9R3pMh0BksZcYJpfT-nRwwqkF+j6F-wLoBg@mail.gmail.com","threadId":"33170","inReplyTo":"CAFaJEqu8gHSLK5u7v5ZOaJ1XjAhV=F9p46MEo2sDVH4vpXAojA@mail.gmail.com","subject":"Re: Suggestion for difftool behaviour during a merge conflict","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2013-03-13T22:26:03Z","receivedAt":"2013-03-13T22:26:03Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Wed, Mar 13, 2013 at 11:48 AM, Øystein Walle <oystwa@gmail.com> wrote:\n> When a merge is ongoing and there are conflicts, 'git difftool' will\n> output the exact same --cc-style diff output as 'git diff' will without\n> further explanation. This has lead to some confusion: A couple of weeks\n> ago a person asked on #git why his difftool wasn't working. After a long\n> while we realized difftool's behaviour after invocations such as 'git\n> difftool HEAD~ HEAD' would work as expected but 'git difftool' \"simply\n> wouldn't\".\n>\n> With that in mind I have three suggestions on improving 'git difftool':\n>\n>  - Show a three-way diff between the versions (local, remote, merge)\n>    using the user's configured difftool. Diffing against the version\n>    containing the markers will generate some extra noise in the difftool\n>    and might be confusing, but it's similar in behaviour to how 'git\n>    difftool' normally works.\n>\n>  - Prompt the user if they want to launch 'git mergetool' instead since\n>    a merge is ongoing. Reasonable but it might be awkward if the user is\n>    asked whether the conflict was resolved or not when all they wanted\n>    to do was to visually diff something.\n>\n>  - Add a notice to stderr saying that a --cc-style diff output is shown\n>    instead; or document the behaviour in the man page. Definitely the\n>    simplest option.\n>\n> I'm willing to try to take a stab at either of these but I wanted to\n> bring it up first. There is of course an implicit fourth option which is\n> to do nothing, and that I'm wrong about this :)\n\nThanks for bringing this up.\n\nI think the simplest first step would be to detect this state,\nprint a message saying that difftool cannot be used during a merge,\nand suggest mergetool instead.\n\nWe would need to be careful to still allow difftool <ref> <ref>\nand only trigger this behavior when the cc-style diff would be printed.\n\nI have a feeling that this happens deep in git-diff.\ngit-difftool--helper is driven by git-diff via the\nGIT_EXTERNAL_DIFF mechanism, and that mechanism is probably not\ntriggered when in this state, so we may need to add another\nbreadcrumb that we can build upon.\n\n> Best regards,\n> Øystein Walle\n\ncheers,\n-- \nDavid\n"}]}