{"thread":{"id":"25989","subject":"diff for deleted file only, when changed to directory","startedAt":"2010-12-08T08:12:33Z","lastAt":"2010-12-08T09:56:32Z","messageCount":4,"participants":["Bert Wesarg","Jonathan Nieder","Nguyen Thai Ngoc Duy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"157582","messageId":"AANLkTimXOKC_9TJU1foNkTqPHouFPouzZw3XU_9Za=na@mail.gmail.com","threadId":"25989","inReplyTo":null,"subject":"diff for deleted file only, when changed to directory","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-12-08T08:12:33Z","receivedAt":"2010-12-08T08:12:33Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Hi,\n\nwhen I stage a file deletion (named foo) and than add a new file\n(named foo/bar) in a directory with  the name of deleted file. git\ndiff --cached -- foo shows me the diff for both the file foo and file\nfoo/bar.\n\nHere is a recipe:\n\necho foo >f\ngit add f\ngit commit -mfoo\ngit rm f\nmkdir f\necho bar >f/0\ngit add f/0\ngit diff -- f\ngit diff --cached -- f\n\ngives me this:\n\ndiff --git c/f i/f\ndeleted file mode 100644\nindex 257cc56..0000000\n--- c/f\n+++ /dev/null\n@@ -1 +0,0 @@\n-foo\ndiff --git c/f/0 i/f/0\nnew file mode 100644\nindex 0000000..5716ca5\n--- /dev/null\n+++ i/f/0\n@@ -0,0 +1 @@\n+bar\n\nFor the other case, when I stage a symlink under the name foo, I can\nunderstand that git diff shows me two diffs. But for the case\nfile->directory, I would like to see only the deleted diff, not\nrecursing into the directory.\n\nBert\n"},{"id":"157583","messageId":"20101208082103.GA4927@burratino","threadId":"25989","inReplyTo":"AANLkTimXOKC_9TJU1foNkTqPHouFPouzZw3XU_9Za=na@mail.gmail.com","subject":"Re: diff for deleted file only, when changed to directory","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-08T08:21:03Z","receivedAt":"2010-12-08T08:21:03Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Bert Wesarg wrote:\n\n>                                                                git\n> diff --cached -- foo shows me the diff for both the file foo and file\n> foo/bar.\n[...]\n>                                              But for the case\n> file->directory, I would like to see only the deleted diff, not\n> recursing into the directory.\n\nIf I understand correctly, this is a documentation bug and feature\nrequest.\n\nThe documentation bug: the \"git diff\" documentation says something\nlike\n\n\tgit diff [--options] [<tree>[..<tree>]] [--] [<path>...]\n\nbut the <path>s after \"--\" are actually patterns (path specifiers).\nSee [1] ([RFD] git glossary: define pathspec, 2010-11-29).\n\nThe feature request: there is no way to specify an \"exact match\"\nor \"negative match\" when specifying paths.  At least \"negative\nmatch\" has been suggested before.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/162379\n"},{"id":"157587","messageId":"AANLkTikMf5qRaqkdiOKP_PBf=Q68fMc2U5WVN-7SWFYC@mail.gmail.com","threadId":"25989","inReplyTo":"20101208082103.GA4927@burratino","subject":"Re: diff for deleted file only, when changed to directory","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-12-08T09:29:07Z","receivedAt":"2010-12-08T09:29:07Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/12/8 Jonathan Nieder <jrnieder@gmail.com>:\n> Bert Wesarg wrote:\n>\n>>                                                                git\n>> diff --cached -- foo shows me the diff for both the file foo and file\n>> foo/bar.\n> [...]\n>>                                              But for the case\n>> file->directory, I would like to see only the deleted diff, not\n>> recursing into the directory.\n>\n> If I understand correctly, this is a documentation bug and feature\n> request.\n>\n> The documentation bug: the \"git diff\" documentation says something\n> like\n>\n>        git diff [--options] [<tree>[..<tree>]] [--] [<path>...]\n>\n> but the <path>s after \"--\" are actually patterns (path specifiers).\n> See [1] ([RFD] git glossary: define pathspec, 2010-11-29).\n>\n> The feature request: there is no way to specify an \"exact match\"\n> or \"negative match\" when specifying paths.  At least \"negative\n> match\" has been suggested before.\n>\n\nThanks for the pointers.\n\nI don't expect that we can change <foo> to match only files and not directories.\n\nBert\n\n> [1] http://thread.gmane.org/gmane.comp.version-control.git/162379\n>\n"},{"id":"157588","messageId":"AANLkTinW4DjHnNORH3FRi7fQsYAf+Ky_Jr14ZxOu2So2@mail.gmail.com","threadId":"25989","inReplyTo":"AANLkTikMf5qRaqkdiOKP_PBf=Q68fMc2U5WVN-7SWFYC@mail.gmail.com","subject":"Re: diff for deleted file only, when changed to directory","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-12-08T09:56:32Z","receivedAt":"2010-12-08T09:56:32Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"2010/12/8 Bert Wesarg <bert.wesarg@googlemail.com>:\n> 2010/12/8 Jonathan Nieder <jrnieder@gmail.com>:\n>> Bert Wesarg wrote:\n>>\n>>>                                                                git\n>>> diff --cached -- foo shows me the diff for both the file foo and file\n>>> foo/bar.\n>> [...]\n>>>                                              But for the case\n>>> file->directory, I would like to see only the deleted diff, not\n>>> recursing into the directory.\n>>\n>> If I understand correctly, this is a documentation bug and feature\n>> request.\n>>\n>> The documentation bug: the \"git diff\" documentation says something\n>> like\n>>\n>>        git diff [--options] [<tree>[..<tree>]] [--] [<path>...]\n>>\n>> but the <path>s after \"--\" are actually patterns (path specifiers).\n>> See [1] ([RFD] git glossary: define pathspec, 2010-11-29).\n>>\n>> The feature request: there is no way to specify an \"exact match\"\n>> or \"negative match\" when specifying paths.  At least \"negative\n>> match\" has been suggested before.\n>>\n>\n> Thanks for the pointers.\n>\n> I don't expect that we can change <foo> to match only files and not directories.\n\nTry\n\ndiff --cached -- '[f]'\n\nFrom top of my memory, directory matching does not work with\nwildcards. By putting wildcards to your patterns, dir should never be\nmatched again. I haven't tested it though.\n-- \nDuy\n"}]}