{"thread":{"id":"49305","subject":"Fwd: [Possible GIT Bug]","startedAt":"2018-09-09T13:31:12Z","lastAt":"2018-09-10T18:37:49Z","messageCount":6,"participants":["Dylan Young","Bryan Turner","Jeff King","Junio C Hamano","Eckhard Maaß"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"357759","messageId":"CAPGJNu5=GkiALR1=RYgHLv3NDrycqv13jpU5_=SOW-yWtRXduw@mail.gmail.com","threadId":"49305","inReplyTo":"CAPGJNu5RPXjeib-vayVzmFkU9cZ=h5o5VDoM1vQqv2+HgtNXLw@mail.gmail.com","subject":"Fwd: [Possible GIT Bug]","fromName":"Dylan Young","fromEmail":"dylanyoungmeijer@gmail.com","sentAt":"2018-09-09T13:30:59Z","receivedAt":"2018-09-09T13:31:12Z","isPatch":false,"sender":{"key":"dylanyoungmeijer@gmail.com","avatar":null},"body":"Works:\n\n\n\ngit show -C --find-copies-harder  055f6c89fa4506037d1621761f13430f469b8029\n\ngit show -C --find-copies-harder\n055f6c89fa4506037d1621761f13430f469b8029 --name-status\n\n\n\n\n\nDoesn’t Work:\n\n\n\ngit show -C --find-copies-harder\n055f6c89fa4506037d1621761f13430f469b8029  --  PATH_TO_MY_COPIED_FILE\n\n\n\ni.e.\n\n--- /dev/null\n\n+++ b/ PATH_TO_MY_COPIED_FILE\n\n\n\n\n\nHope that’s self-explanatory!!!\n\n\n\nBest,\n\n\n\n\n\nCasey Meijer\n"},{"id":"357773","messageId":"CAGyf7-EFiZ7ouUPDMtv3eb57QEiM2pkavyKQe7iNO7+eBeuZ9w@mail.gmail.com","threadId":"49305","inReplyTo":"CAPGJNu5=GkiALR1=RYgHLv3NDrycqv13jpU5_=SOW-yWtRXduw@mail.gmail.com","subject":"Re: [Possible GIT Bug]","fromName":"Bryan Turner","fromEmail":"bturner@atlassian.com","sentAt":"2018-09-09T19:04:58Z","receivedAt":"2018-09-09T19:05:12Z","isPatch":false,"sender":{"key":"bturner@atlassian.com","avatar":"https://gravatar.com/avatar/16bcf3167981c1ef7c804e502642366d888a35b0d0b0a4ca01fdc442aa1acb1e?d=mp&s=160"},"body":"On Sun, Sep 9, 2018 at 6:31 AM Dylan Young <dylanyoungmeijer@gmail.com> wrote:\n>\n> Works:\n>\n> git show -C --find-copies-harder  055f6c89fa4506037d1621761f13430f469b8029\n>\n> git show -C --find-copies-harder\n> 055f6c89fa4506037d1621761f13430f469b8029 --name-status\n\nHere, because you didn't provide _any_ paths, Git is allowed to\nconsider all of the paths modified in the commit and, because you\nspecified --find-copies-harder, it's allowed to consider paths that\n_weren't_ modified too. That means it can \"see\" both the source and\ndestination for the copy, and it detects the copy as you're expecting.\n\n>\n> Doesn’t Work:\n>\n> git show -C --find-copies-harder\n> 055f6c89fa4506037d1621761f13430f469b8029  --  PATH_TO_MY_COPIED_FILE\n\nHere, though, you've _explicitly limited_ Git to only the copied file.\nIt's not allowed to consider any others, which means it can't \"see\"\nthe source path anymore. As a result, the copy is detected as a\nstraight add. Note that --find-copies-harder means the diff machinery\nis allowed to consider files that weren't modified in the commit as\npossible sources for copies, but that's still subject to your explicit\nfiltering. In other words, if PATH_TO_SOURCE_FILE wasn't modified,\nrunning this would _not_ see a copy:\n\ngit show -C 055f6c89fa4506037d1621761f13430f469b8029  --\nPATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE\n\nBut running this would:\n\ngit show -C -C 055f6c89fa4506037d1621761f13430f469b8029  --\nPATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE\n\nNo bugs here. Everything is working as intended, if not, perhaps, as\nyou expected.\n\nHope this helps,\nBryan\n\n>\n> i.e.\n>\n> --- /dev/null\n>\n> +++ b/ PATH_TO_MY_COPIED_FILE\n>\n> Hope that’s self-explanatory!!!\n>\n> Best,\n> Casey Meijer\n"},{"id":"357782","messageId":"20180910132452.GB5233@sigill.intra.peff.net","threadId":"49305","inReplyTo":"CAGyf7-EFiZ7ouUPDMtv3eb57QEiM2pkavyKQe7iNO7+eBeuZ9w@mail.gmail.com","subject":"Re: [Possible GIT Bug]","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-09-10T13:24:53Z","receivedAt":"2018-09-10T13:24:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Sep 09, 2018 at 12:04:58PM -0700, Bryan Turner wrote:\n\n> Here, though, you've _explicitly limited_ Git to only the copied file.\n> It's not allowed to consider any others, which means it can't \"see\"\n> the source path anymore. As a result, the copy is detected as a\n> straight add. Note that --find-copies-harder means the diff machinery\n> is allowed to consider files that weren't modified in the commit as\n> possible sources for copies, but that's still subject to your explicit\n> filtering. In other words, if PATH_TO_SOURCE_FILE wasn't modified,\n> running this would _not_ see a copy:\n> \n> git show -C 055f6c89fa4506037d1621761f13430f469b8029  --\n> PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE\n> \n> But running this would:\n> \n> git show -C -C 055f6c89fa4506037d1621761f13430f469b8029  --\n> PATH_TO_MY_COPIED_FILE PATH_TO_SOURCE_FILE\n> \n> No bugs here. Everything is working as intended, if not, perhaps, as\n> you expected.\n\nYour explanation is correct. To be fair, though, it seems like\n--find-copies-harder is made a lot less useful by the not considering\nthe larger set of sources, since that's kind of its point. I'm not sure\nif this behavior actually is intentional, or simply what happens to\noccur based on the combination of features.\n\nYou can do:\n\n  git log -C C --full-diff $commit -- $path\n\nto limit a traversal to commits touching $path, but still see the full\ndiff (including possible copy sources). But AFAIK there's no option to\nlimit the diff, but include extra copy sources.\n\nI'd be tempted to say we should do that automatically when\n--find-copies-harder is in effect, but it's possible that some people\nactually do want the current behavior. For a single path it's silly, but\nif you did something like this:\n\n  git show -C -C $commit -- foo/\n\nthat would find differences in the foo/ directory, and find copies only\nfrom sources in foo/. That limits the result, but also limits the\neffort, which can be important given the cost of copy detection.\n\n-Peff\n"},{"id":"357790","messageId":"xmqqin3duypt.fsf@gitster-ct.c.googlers.com","threadId":"49305","inReplyTo":"20180910132452.GB5233@sigill.intra.peff.net","subject":"Re: [Possible GIT Bug]","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-09-10T16:03:10Z","receivedAt":"2018-09-10T16:03:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Your explanation is correct. To be fair, though, it seems like\n> --find-copies-harder is made a lot less useful by the not considering\n> the larger set of sources, since that's kind of its point. I'm not sure\n> if this behavior actually is intentional, or simply what happens to\n> occur based on the combination of features.\n\nIt is neither but if I have to pick one between the two, it is much\ncloser to the former than the latter.  The primary source of this is\nthat we have only *one* pathspec given to the diff machinery, but in\norder to implement your ideal \"find harder\", you'd need *two*.  That\nis, one set of paths for which you are interested in their origin,\nand the other set that you allow the machinery to consider as possible\norigins.  Since we can only give one pathspec machinery, that one\npathspec is used to specify both of these sets.\n"},{"id":"357807","messageId":"20180910173512.GA22152@esm","threadId":"49305","inReplyTo":"xmqqin3duypt.fsf@gitster-ct.c.googlers.com","subject":"Re: [Possible GIT Bug]","fromName":"Eckhard Maaß","fromEmail":"eckhard.s.maass@googlemail.com","sentAt":"2018-09-10T17:35:12Z","receivedAt":"2018-09-10T17:35:18Z","isPatch":false,"sender":{"key":"eckhard.s.maass@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/21984134?v=4"},"body":"On Mon, Sep 10, 2018 at 09:03:10AM -0700, Junio C Hamano wrote:\n> It is neither but if I have to pick one between the two, it is much\n> closer to the former than the latter.  The primary source of this is\n> that we have only *one* pathspec given to the diff machinery, but in\n> order to implement your ideal \"find harder\", you'd need *two*.  That\n> is, one set of paths for which you are interested in their origin,\n> and the other set that you allow the machinery to consider as possible\n> origins.  Since we can only give one pathspec machinery, that one\n> pathspec is used to specify both of these sets.\n\nHow does tihs compare to `--follow`? With that knob active the machinery\nindeed uses the whole repository for finding renames and/or copies. Is\nthis the only exception then?\n\nTake care,\nEckhard\n"},{"id":"357812","messageId":"xmqq5zzdtczq.fsf@gitster-ct.c.googlers.com","threadId":"49305","inReplyTo":"20180910173512.GA22152@esm","subject":"Re: [Possible GIT Bug]","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-09-10T18:37:45Z","receivedAt":"2018-09-10T18:37:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Eckhard Maaß\" <eckhard.s.maass@googlemail.com> writes:\n\n> On Mon, Sep 10, 2018 at 09:03:10AM -0700, Junio C Hamano wrote:\n>> It is neither but if I have to pick one between the two, it is much\n>> closer to the former than the latter.  The primary source of this is\n>> that we have only *one* pathspec given to the diff machinery, but in\n>> order to implement your ideal \"find harder\", you'd need *two*.  That\n>> is, one set of paths for which you are interested in their origin,\n>> and the other set that you allow the machinery to consider as possible\n>> origins.  Since we can only give one pathspec machinery, that one\n>> pathspec is used to specify both of these sets.\n>\n> How does tihs compare to `--follow`? With that knob active the machinery\n> indeed uses the whole repository for finding renames and/or copies. Is\n> this the only exception then?\n\n'--follow' is a checkbox hack that is not even properly integrated\nwith the diff machinery (it only exists on the \"log\" side of the\ntool), so I do not think it is productive to find a comparison.\n"}]}