{"thread":{"id":"35919","subject":"git log omits deleting merges","startedAt":"2014-02-20T07:35:33Z","lastAt":"2014-03-24T14:19:34Z","messageCount":6,"participants":["Ephrim Khong","Jeff King","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"235090","messageId":"5305B045.2060503@gmail.com","threadId":"35919","inReplyTo":null,"subject":"git log omits deleting merges","fromName":"Ephrim Khong","fromEmail":"dr.khong@gmail.com","sentAt":"2014-02-20T07:35:33Z","receivedAt":"2014-02-20T07:35:33Z","isPatch":false,"sender":{"key":"dr.khong@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2847265?v=4"},"body":"Hi, git log seems to omit merge commits that delete a file if --follow \nor --diff-filter=D is given. Below is a testcase. I'm not sure if it is \ndesired behaviour for --diff-filter=D, but it's probably not correct \nthat --follow _removes_ the merge commit from the log output.\n\nThanks - Eph\n\n--\ngit init\ntouch some_file\ngit add some_file\ngit commit -m \"initial\"\ngit branch other_branch\necho foo > some_file\ngit commit -a -m \"commit in master\"\ngit checkout other_branch\necho bar > some_file\ngit commit -a -m \"commit in other_branch\"\n\ngit merge master --no-commit\nrm some_file\ngit rm some_file\ngit commit -m \"merge\"\n\necho \"log 1 - no output\"\n# note that --diff-filter=A and M work as expected\n# the merge does not show up for --diff-filter=ACDMRTUXB either\ngit log --pretty=oneline --diff-filter=D -- some_file\n\necho \"log 2 - merge is missing\"\ngit log --pretty=oneline --follow --all -- some_file\n\necho \"log 3 - complete\"\ngit log --pretty=oneline --all -- some_file\n--\n"},{"id":"237202","messageId":"20140320195404.GA19252@sigill.intra.peff.net","threadId":"35919","inReplyTo":"5305B045.2060503@gmail.com","subject":"Re: git log omits deleting merges","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-20T19:54:04Z","receivedAt":"2014-03-20T19:54:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:\n\n> Hi, git log seems to omit merge commits that delete a file if --follow or\n> --diff-filter=D is given. Below is a testcase. I'm not sure if it is desired\n> behaviour for --diff-filter=D, but it's probably not correct that --follow\n> _removes_ the merge commit from the log output.\n\nThis is by design. Git-log does not calculate or show merge diffs unless\n\"-c\" or \"--cc\" is specified, and thus no diff-filter can match.\n\n> echo \"log 1 - no output\"\n> # note that --diff-filter=A and M work as expected\n> # the merge does not show up for --diff-filter=ACDMRTUXB either\n> git log --pretty=oneline --diff-filter=D -- some_file\n\nTry:\n\n  git log -c --diff-filter=D -- some_file\n\nwhich does show it.\n\n-Peff\n"},{"id":"237223","messageId":"BC292A8591EF4E8AB1E553FBF6ECC336@PhilipOakley","threadId":"35919","inReplyTo":"20140320195404.GA19252@sigill.intra.peff.net","subject":"Re: git log omits deleting merges","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-03-20T22:16:25Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Jeff King\" <peff@peff.net>\n> On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:\n>\n>> Hi, git log seems to omit merge commits that delete a file\n>> if --follow or\n>> --diff-filter=D is given. Below is a testcase. I'm not sure if it is\n>> desired\n>> behaviour for --diff-filter=D, but it's probably not correct\n>> that --follow\n>> _removes_ the merge commit from the log output.\n>\n> This is by design. Git-log does not calculate or show merge diffs\n> unless\n> \"-c\" or \"--cc\" is specified, and thus no diff-filter can match.\n\nThis is hard to discern from the log(1) man page as this conflates\ncommit inclusion (limiting?) with the diff formatting.\n\nThe -c and -cc options are listed in the diff formatting section, but\nthat's well down the man page. Even then, the note for the options \ndoesn't say that it will cause the log output to now include the merge \ncommits.\n\nPerhaps the -c and -cc options should also be noted in the options or\nthe commit limiting section, but exactly where is probably contentious \n(maybe under the --merges).\n\n(or I may have misunderstood)\n\n>\n>> echo \"log 1 - no output\"\n>> # note that --diff-filter=A and M work as expected\n>> # the merge does not show up for --diff-filter=ACDMRTUXB either\n>> git log --pretty=oneline --diff-filter=D -- some_file\n>\n> Try:\n>\n>  git log -c --diff-filter=D -- some_file\n>\n> which does show it.\n>\n> -Peff\n> --\nPhilip\n-- \n"},{"id":"237263","messageId":"20140321052312.GB31161@sigill.intra.peff.net","threadId":"35919","inReplyTo":"BC292A8591EF4E8AB1E553FBF6ECC336@PhilipOakley","subject":"Re: git log omits deleting merges","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-21T05:23:12Z","receivedAt":"2014-03-21T05:23:12Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 20, 2014 at 10:56:58PM -0000, Philip Oakley wrote:\n\n> >This is by design. Git-log does not calculate or show merge diffs\n> >unless\n> >\"-c\" or \"--cc\" is specified, and thus no diff-filter can match.\n> \n> This is hard to discern from the log(1) man page as this conflates\n> commit inclusion (limiting?) with the diff formatting.\n> \n> The -c and -cc options are listed in the diff formatting section, but\n> that's well down the man page. Even then, the note for the options doesn't\n> say that it will cause the log output to now include the merge commits.\n\nMerge commits are always considered. But we don't show merge _diffs_\nwithout \"-c\" or \"--cc\". And they cannot match a diff-filter if we don't\ncalculate the diffs.\n\nThat being said, I can certainly imagine there is room for improvement\nin the documentation.  The --diff-filter option is in the \"diff options\"\nsection, but perhaps the top of that section might want to make special\nmention of \"-c\" and \"--cc\"?\n\n-Peff\n"},{"id":"237438","messageId":"5330081C.3090403@gmail.com","threadId":"35919","inReplyTo":"20140320195404.GA19252@sigill.intra.peff.net","subject":"Re: git log omits deleting merges","fromName":"Ephrim Khong","fromEmail":"dr.khong@gmail.com","sentAt":"2014-03-24T10:25:32Z","receivedAt":"2014-03-24T10:25:32Z","isPatch":false,"sender":{"key":"dr.khong@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2847265?v=4"},"body":"Am 20.03.14 20:54, schrieb Jeff King:\n> On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:\n>\n>> Hi, git log seems to omit merge commits that delete a file if --follow or\n>> --diff-filter=D is given. Below is a testcase. I'm not sure if it is desired\n>> behaviour for --diff-filter=D, but it's probably not correct that --follow\n>> _removes_ the merge commit from the log output.\n>\n> This is by design. Git-log does not calculate or show merge diffs unless\n> \"-c\" or \"--cc\" is specified, and thus no diff-filter can match.\n\nThank you for the explanation, I now understand why this is happening \nfrom a technical point of view. From a usability perspective, it is a \nbit confusing that a flag that should intuitively increase the number of \nshown commits (--follow) removes a commit from the output. Though this \nis just a minor annoyance, so no strong opinion here.\n\n- Eph\n"},{"id":"237443","messageId":"20140324141934.GA651@sigill.intra.peff.net","threadId":"35919","inReplyTo":"5330081C.3090403@gmail.com","subject":"Re: git log omits deleting merges","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-03-24T14:19:34Z","receivedAt":"2014-03-24T14:19:34Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Mar 24, 2014 at 11:25:32AM +0100, Ephrim Khong wrote:\n\n> Thank you for the explanation, I now understand why this is happening from a\n> technical point of view. From a usability perspective, it is a bit confusing\n> that a flag that should intuitively increase the number of shown commits\n> (--follow) removes a commit from the output. Though this is just a minor\n> annoyance, so no strong opinion here.\n\nSorry, I focused on the --diff-filter aspect of your question. As for\n--follow, I think that is less \"by design\" and more \"what happens to\noccur, because --follow is a bit of a hack\".\n\nSo there may be a bug, or room for improvement in the code there, though\nif the solution involves turning on diffs for all merges, that may be\nprohibitively expensive.\n\n-Peff\n"}]}