{"thread":{"id":"53964","subject":"amend param not available to the pre-commit hook","startedAt":"2020-08-02T13:22:53Z","lastAt":"2020-08-02T15:10:58Z","messageCount":2,"participants":["Andrea Wyss","Phillip Wood"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"402645","messageId":"30DFCBF3-FEA8-4FF5-94ED-A81AB10B04A3@gmail.com","threadId":"53964","inReplyTo":null,"subject":"amend param not available to the pre-commit hook","fromName":"Andrea Wyss","fromEmail":"andrea.wyss@gmail.com","sentAt":"2020-08-02T13:22:49Z","receivedAt":"2020-08-02T13:22:53Z","isPatch":false,"sender":{"key":"andrea.wyss@gmail.com","avatar":null},"body":"﻿Issue\namend param not available to the pre-commit hook\n\nProblem\nCannot write a pre-commit hook that stops amending a commit that is present in other branches.\n\nSteps to Reproduce (git version 2.21.1)\n1. Code in the pre-commit hook:\n  echo \"DEBUG 0='$0' 1='$1'\"\n\n2. run:\n  git commit --amend\n\nCurrent Result\n  DEBUG 0='.git/hooks/pre-commit' 1=''\n\nExpected Result\n  DEBUG 0='.git/hooks/pre-commit' 1='--amend'\n\nPlease, let me know if you need other info.\nI'm looking forward for a fix or workaround.\n\nThank you,\nAndrea Wyss\n"},{"id":"402652","messageId":"f9016e7a-0769-6a55-ab32-6b54674ae2c1@gmail.com","threadId":"53964","inReplyTo":"30DFCBF3-FEA8-4FF5-94ED-A81AB10B04A3@gmail.com","subject":"Re: amend param not available to the pre-commit hook","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2020-08-02T15:10:53Z","receivedAt":"2020-08-02T15:10:58Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Andrea\n\nOn 02/08/2020 14:22, Andrea Wyss wrote:\n> ﻿Issue\n> amend param not available to the pre-commit hook\n> \n> Problem\n> Cannot write a pre-commit hook that stops amending a commit that is present in other branches.\n> \n> Steps to Reproduce (git version 2.21.1)\n> 1. Code in the pre-commit hook:\n>    echo \"DEBUG 0='$0' 1='$1'\"\n> \n> 2. run:\n>    git commit --amend\n> \n> Current Result\n>    DEBUG 0='.git/hooks/pre-commit' 1=''\n> \n> Expected Result\n>    DEBUG 0='.git/hooks/pre-commit' 1='--amend'\n\nI'm not sure why you expect this, the documentation for the pre-commit \nhook states 'this hook takes no parameters'\n\nThat does not mean that it would not be useful to have this information \navailable to the pre-commit and possibly prepare-commit-msg hooks but it \nis not a bug. I'm not sure that adding a parameter to the hook is a good \nroute as it may break existing hooks that do not expect any parameters, \nmaybe we could pass it in the environment.\n\nBest Wishes\n\nPhillip\n\n> Please, let me know if you need other info.\n> I'm looking forward for a fix or workaround.\n> \n> Thank you,\n> Andrea Wyss\n> \n"}]}