{"thread":{"id":"49523","subject":"bug when combined with etckeeper","startedAt":"2018-10-10T09:53:35Z","lastAt":"2018-10-13T12:36:52Z","messageCount":4,"participants":["Naja Melan","Jeff King","Joey Hess"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"359993","messageId":"4d7cddf8-34b3-eaa4-dc9e-e190062e6135@autistici.org","threadId":"49523","inReplyTo":null,"subject":"bug when combined with etckeeper","fromName":"Naja Melan","fromEmail":"najamelan@autistici.org","sentAt":"2018-10-10T09:33:00Z","receivedAt":"2018-10-10T09:53:35Z","isPatch":false,"sender":{"key":"najamelan@autistici.org","avatar":"https://gravatar.com/avatar/36a314e8a57b71b7c21efc189fcc9d4ee7d5ba7d0b328362c052f5bb32d613c5?d=mp&s=160"},"body":"I am running:\n\nLinux  4.18.12-arch1-1-ARCH #1 SMP PREEMPT Thu Oct 4 01:01:27 UTC 2018 x86_64 GNU/Linux\n\ngit version 2.19.1\n\netckeeper Version: 1.18.8\n\n\nI ran into a strange bug. In the following script the commit at the end will fail with: \n\n> The following paths are ignored by one of your .gitignore files:\n> .etckeeper\n> Use -f if you really want to add them.\n\nNote that there is no .gitignore file and no `.etckeeper` file in the repository, there is nothing in .git/exclude. There is no `core.excludesFile`, not locally, global, nor system. There are no userwide or systemwide ignore files. In fact there is not a single text file on my system which matches the regex '^\\.etckeeper'. \n\nAlso `git check-ignore .etckeeper` returns exit status 1. Thus I conclude that something isn't right. I don't know where the exclude rule comes from...\n\nIt works as expected if the `-a` option is not used on `git commit`.\n\nI have not found any hints in the scripts from the etckeeper package that might explain this.\n\n#------------------------------------------------\n#! /usr/bin/bash\n\nrm -rf gitignorebug\n\nmkdir gitignorebug\n\ncd gitignorebug\n\ngit init\n\ngit config --local user.name  \"git bug\"\ngit config --local user.email \"git@bug.com\"\n\ntouch file\n\ngit add file\n\ngit commit -am\"add file\"\n#---------------------------------------------------\n\nThank you for looking into it.\n"},{"id":"360029","messageId":"20181010143333.GA3854@sigill.intra.peff.net","threadId":"49523","inReplyTo":"4d7cddf8-34b3-eaa4-dc9e-e190062e6135@autistici.org","subject":"Re: bug when combined with etckeeper","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-10-10T14:33:33Z","receivedAt":"2018-10-10T14:33:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 10, 2018 at 09:33:00AM +0000, Naja Melan wrote:\n\n> I ran into a strange bug. In the following script the commit at the end will fail with: \n> \n> > The following paths are ignored by one of your .gitignore files:\n> > .etckeeper\n> > Use -f if you really want to add them.\n> \n> Note that there is no .gitignore file and no `.etckeeper` file in the\n> repository, there is nothing in .git/exclude.\n\nThat's weird. Do you have any git-related environment variables set? Or\nanything in your config that might be pointing git to an alternate\nrepository or working tree?\n\nTry:\n\n  env | grep GIT\n\nand:\n\n  git config --list --show-origin\n\n-Peff\n"},{"id":"360030","messageId":"20181010143427.GA2725@kitenet.net","threadId":"49523","inReplyTo":"4d7cddf8-34b3-eaa4-dc9e-e190062e6135@autistici.org","subject":"Re: bug when combined with etckeeper","fromName":"Joey Hess","fromEmail":"id@joeyh.name","sentAt":"2018-10-10T14:34:27Z","receivedAt":"2018-10-10T14:34:39Z","isPatch":false,"sender":{"key":"id@joeyh.name","avatar":"https://avatars.githubusercontent.com/u/16392?v=4"},"body":"/etc/.git/hooks/pre-commit is installed by etckeeper and runs\netckeeper pre-commit, which deals with /etc/.etckeeper, including\nrunning \"git add .etckeeper\". Why that file would match a gitignore\nseems much less important than why git would run that hook in an\nentirely different git repository.\n\n       core.hooksPath\n           By default Git will look for your hooks in the $GIT_DIR/hooks\n           directory. Set this to different path, e.g.  /etc/git/hooks, and Git\n           will try to find your hooks in that directory, e.g.\n           /etc/git/hooks/pre-receive instead of in $GIT_DIR/hooks/pre-receive.\n\nHmm, the example \"/etc/git/hooks\" there is very similar to the\n\"/etc/.git/hooks\" used by etckeeper. So my guess is you have\ncore.hooksPath set globally.\n\n-- \nsee shy jo\n"},{"id":"360388","messageId":"d9324f66-6eca-32a9-433a-8732998b30a2@autistici.org","threadId":"49523","inReplyTo":"20181010143427.GA2725@kitenet.net","subject":"Re: bug when combined with etckeeper","fromName":"Naja Melan","fromEmail":"najamelan@autistici.org","sentAt":"2018-10-13T12:36:00Z","receivedAt":"2018-10-13T12:36:52Z","isPatch":false,"sender":{"key":"najamelan@autistici.org","avatar":"https://gravatar.com/avatar/36a314e8a57b71b7c21efc189fcc9d4ee7d5ba7d0b328362c052f5bb32d613c5?d=mp&s=160"},"body":"Ok,\n\nmy bad. I had a global pre-commit hook which had a lingering etckeeper command for another repository.\n\nNot quite sure why it only runs when commit has the '-a' option...\n\nThanks for pointing to the hooks possibility.\n\nNaja Melan\n"}]}