{"thread":{"id":"55568","subject":"Bug: Git invokes hooks from wrong directory.","startedAt":"2021-04-27T07:23:41Z","lastAt":"2021-04-27T07:23:41Z","messageCount":1,"participants":["Gabriel Nützi"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"423062","messageId":"e173a3c0-5ca9-4c0e-9a1b-ef5f6aa72340@gmail.com","threadId":"55568","inReplyTo":"03b67357-4d9a-ea66-ad72-f01bb25aa54c@gmail.com","subject":"Bug: Git invokes hooks from wrong directory.","fromName":"Gabriel Nützi","fromEmail":"gnuetzi@gmail.com","sentAt":"2021-04-27T07:23:33Z","receivedAt":"2021-04-27T07:23:41Z","isPatch":false,"sender":{"key":"gnuetzi@gmail.com","avatar":"https://gravatar.com/avatar/eda99c30173930819ae1c26c3dff249edd4b3c735c3886d268c0d6a71c6307c9?d=mp&s=160"},"body":"Dear Community\n\nThe following MWE in\nhttps://stackoverflow.com/questions/67273420/why-does-git-execute-hooks-from-an-other-repository/67276138#67276138\n\nshows a bug that Git executes the hooks in `/tmp/A` instead of \n`/tmp/Githooks`.\n\n# ----------\n|# Make simple repo git init \"/tmp/A\" && cd \"/tmp/A\" || exit 1\n|\n|\n|\n|# Make hook to demonstrate the problem\n   mkdir -p \".git/hooks\" &&\n|\n|echo \"echo 'EXECUTED!!!'\" >.git/hooks/reference-transaction &&\n|\n|  chmod +x \".git/hooks/reference-transaction\" &&\n|\n|  git clone -c core.hooksPath=\".git/hooks\" --template= \n\"https://github.com/gabyx/Githooks.git\" /tmp/Githooks|\n# ----------\n\nWould be nice to know, if this is indeed a bug and should be fixed?\n\nIf somebody points me to the corresponding source code, I could dive in.\nThanks a lot.\n\nBR Gabriel Nützi\n\n\n"}]}