{"thread":{"id":"50918","subject":"Bug(feature?) on git-diff-files","startedAt":"2019-04-11T12:48:11Z","lastAt":"2019-04-12T12:41:36Z","messageCount":4,"participants":["NoName Req","Jeff King","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"373632","messageId":"CABgj7us=Rk3EUvd2EVVqsYKDUGS7VfAX09SpW04fB26cgntw5g@mail.gmail.com","threadId":"50918","inReplyTo":null,"subject":"Bug(feature?) on git-diff-files","fromName":"NoName Req","fromEmail":"nonamereq29@gmail.com","sentAt":"2019-04-11T12:47:58Z","receivedAt":"2019-04-11T12:48:11Z","isPatch":false,"sender":{"key":"nonamereq29@gmail.com","avatar":null},"body":"Summary\n   `git -C (folder path) diff-files --name-only` output is not correct\n\nSteps to Reproduce\n1. Apply change to a clean git repository. Go to another folder (not\nwithin this repository) and apply the command\n   `git -C repo-path diff-files --name-only`\nThe above command lists dirty files in that repository.\n2. Now undo your changes on the repository\n3. Issue the same command. It still lists the file.\n\nMore Information\n\n`git -C repo-path diff`  command doesn't seem to have this problem.\n\nSystem Information\n\nArch Linux 5.0.7-arch1-1-ARCH\ngit version 2.21.0\n"},{"id":"373633","messageId":"20190411125703.GA26995@sigill.intra.peff.net","threadId":"50918","inReplyTo":"CABgj7us=Rk3EUvd2EVVqsYKDUGS7VfAX09SpW04fB26cgntw5g@mail.gmail.com","subject":"Re: Bug(feature?) on git-diff-files","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-04-11T12:57:04Z","receivedAt":"2019-04-11T12:57:07Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 11, 2019 at 03:47:58PM +0300, NoName Req wrote:\n\n> Summary\n>    `git -C (folder path) diff-files --name-only` output is not correct\n> \n> Steps to Reproduce\n> 1. Apply change to a clean git repository. Go to another folder (not\n> within this repository) and apply the command\n>    `git -C repo-path diff-files --name-only`\n> The above command lists dirty files in that repository.\n> 2. Now undo your changes on the repository\n> 3. Issue the same command. It still lists the file.\n> \n> More Information\n> \n> `git -C repo-path diff`  command doesn't seem to have this problem.\n\nTry running `git update-index --refresh` before running `diff-files`.\n\nUnlike git-diff, git-diff-files is plumbing that is meant to be called\nfrom scripts. So it is up to the script writer to decide when the index\nshould be refreshed from the actual filesystem (which makes sense, e.g.,\nif you're going to do it once at the start of the script and then make a\nbunch of separate diff-related calls).\n\nUntil that happens, diff-files will see only that the entry is\nstat-dirty, and report it as a potential change.\n\n-Peff\n"},{"id":"373634","messageId":"CACsJy8B0dmonaCuAmT6wNJae8iX0JxUOvU-P=zvjVUrQnoHoUw@mail.gmail.com","threadId":"50918","inReplyTo":"CABgj7us=Rk3EUvd2EVVqsYKDUGS7VfAX09SpW04fB26cgntw5g@mail.gmail.com","subject":"Re: Bug(feature?) on git-diff-files","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-04-11T12:56:55Z","receivedAt":"2019-04-11T12:57:25Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Apr 11, 2019 at 7:49 PM NoName Req <nonamereq29@gmail.com> wrote:\n>\n> Summary\n>    `git -C (folder path) diff-files --name-only` output is not correct\n>\n> Steps to Reproduce\n> 1. Apply change to a clean git repository. Go to another folder (not\n> within this repository) and apply the command\n>    `git -C repo-path diff-files --name-only`\n> The above command lists dirty files in that repository.\n> 2. Now undo your changes on the repository\n> 3. Issue the same command. It still lists the file.\n>\n> More Information\n>\n> `git -C repo-path diff`  command doesn't seem to have this problem.\n\nI haven't tried to reproduce. But my first impression is diff-files,\nas a low-level plumbing sometimes requires you to refresh the index\nfirst. Sometimes without that, you'll get wrong output.\n\n\"git diff\" is a more high-level command that always refreshes the\nindex internally.\n\n>\n> System Information\n>\n> Arch Linux 5.0.7-arch1-1-ARCH\n> git version 2.21.0\n\n\n\n-- \nDuy\n"},{"id":"373745","messageId":"CABgj7uu95Pg7jJY1CN7kUS-SWE6+FCgQshuzWWRrhMqBd_zMMA@mail.gmail.com","threadId":"50918","inReplyTo":"CACsJy8B0dmonaCuAmT6wNJae8iX0JxUOvU-P=zvjVUrQnoHoUw@mail.gmail.com","subject":"Re: Bug(feature?) on git-diff-files","fromName":"NoName Req","fromEmail":"nonamereq29@gmail.com","sentAt":"2019-04-12T12:41:22Z","receivedAt":"2019-04-12T12:41:36Z","isPatch":false,"sender":{"key":"nonamereq29@gmail.com","avatar":null},"body":"Okay thanks for the reply. I didn't know about git update-index will\ntry that now.\n\nOn Thu, Apr 11, 2019 at 3:57 PM Duy Nguyen <pclouds@gmail.com> wrote:\n>\n> On Thu, Apr 11, 2019 at 7:49 PM NoName Req <nonamereq29@gmail.com> wrote:\n> >\n> > Summary\n> >    `git -C (folder path) diff-files --name-only` output is not correct\n> >\n> > Steps to Reproduce\n> > 1. Apply change to a clean git repository. Go to another folder (not\n> > within this repository) and apply the command\n> >    `git -C repo-path diff-files --name-only`\n> > The above command lists dirty files in that repository.\n> > 2. Now undo your changes on the repository\n> > 3. Issue the same command. It still lists the file.\n> >\n> > More Information\n> >\n> > `git -C repo-path diff`  command doesn't seem to have this problem.\n>\n> I haven't tried to reproduce. But my first impression is diff-files,\n> as a low-level plumbing sometimes requires you to refresh the index\n> first. Sometimes without that, you'll get wrong output.\n>\n> \"git diff\" is a more high-level command that always refreshes the\n> index internally.\n>\n> >\n> > System Information\n> >\n> > Arch Linux 5.0.7-arch1-1-ARCH\n> > git version 2.21.0\n>\n>\n>\n> --\n> Duy\n"}]}