{"thread":{"id":"30132","subject":"Question: how to have ls-files use the .gitignore in the index","startedAt":"2012-04-02T23:07:08Z","lastAt":"2012-04-06T11:21:13Z","messageCount":2,"participants":["Holding, Lawrence","Kevin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188366","messageId":"A5E8E180685CEF45AB9E737A010799805DFACA@cdnz-ex1.corp.cubic.cub","threadId":"30132","inReplyTo":null,"subject":"Question: how to have ls-files use the .gitignore in the index","fromName":"Holding, Lawrence","fromEmail":"lawrence.holding@cubic.com","sentAt":"2012-04-02T23:07:08Z","receivedAt":"2012-04-02T23:07:08Z","isPatch":false,"sender":{"key":"lawrence.holding@cubic.com","avatar":null},"body":"I have a pre-commit hook that checks the index for files that match the\nignores / excludes in the repository. But sometimes this will run on a\nrepository where not all the folders are up-to-date with the tip, and\nwill then test against the working tree versions of these files and not\nthose in the index.\n\nfrom pre-commit:\n\n\tif git ls-files -i --exclude-standard | grep .\n\tthen\n\t    exit 1\n\tfi \n\nIs there an option to have ls-files use the excludes in the index\nwithout checking out the whole file tree?\n\nThanks,\n"},{"id":"188649","messageId":"20120406112113.GA4528@ikke-laptop.buyways.nl","threadId":"30132","inReplyTo":"A5E8E180685CEF45AB9E737A010799805DFACA@cdnz-ex1.corp.cubic.cub","subject":"Re: Question: how to have ls-files use the .gitignore in the index","fromName":"Kevin","fromEmail":"compufreak@gmail.com","sentAt":"2012-04-06T11:21:13Z","receivedAt":"2012-04-06T11:21:13Z","isPatch":false,"sender":{"key":"compufreak@gmail.com","avatar":"https://gravatar.com/avatar/10ca3ab6beccce3bbb196f655727a5ece331d2c95062270ef9d52e64f0d9356b?d=mp&s=160"},"body":"What I would do is check out the file from the index to a temporary\nfile, and use that as an exclude file.\n\nYou can probably use git checkout-index in combination with --temp to\ncreate the file.\n\nKevin\n\nOn Tue, Apr 03, 2012 at 11:07:08AM +1200, Holding, Lawrence wrote:\n> I have a pre-commit hook that checks the index for files that match the\n> ignores / excludes in the repository. But sometimes this will run on a\n> repository where not all the folders are up-to-date with the tip, and\n> will then test against the working tree versions of these files and not\n> those in the index.\n> \n> from pre-commit:\n> \n> \tif git ls-files -i --exclude-standard | grep .\n> \tthen\n> \t    exit 1\n> \tfi \n> \n> Is there an option to have ls-files use the excludes in the index\n> without checking out the whole file tree?\n> \n> Thanks,\n"}]}