git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: HowTo distribute a hook with the reposity.

From
JHJohn P. Hartmann <jphartmann@gmail.com>
Date
Dec 28, 2016, 09:09 UTC
Message-ID
<39886f48-c48f-6800-8aa4-20e0b2ab0e6d@gmail.com>
In-Reply-To
<20161228085248.tu54e6ug5fvpr26l@sigill.intra.peff.net>

Thanks, Peff, for your lucid answer to my question and much more. All is now clear to me.

The problem I am grappling with is how to obtain the latest git commit hash and enter it into the generated code. Configure/make would appear to the the time, but by then the user may not have git installed (e.g., extracted the project as .zip from github), so it needs to be done "back at the farm".

I hear that the best I can do is create a normal script in the repro and add to the developer handbook that "btw, here is a git hook that will run it automatically if you so choose".

Thank you both for your prompt and exhaustive answers.
	j.
On 28/12/16 08:52, Jeff King wrote:
Show 16 quoted lines
> On Wed, Dec 28, 2016 at 08:42:25AM +0000, John P. Hartmann wrote:
>
>> This project is hosted on github.  If I put the hook into the repository
>> manually (if I can; I don't know that), is it true that the hook would be
>> distributed on a clone action, but not on a pull?
>
> I'm not sure what you mean by "into the repository". If you mean "into
> the .git directory", then no, you can't do that. Git will not add ".git"
> directory contents to a repository, you cannot manipulate the contents
> of ".git" directories on GitHub, and a client wouldn't ever look at them
> on clone or fetch anyway.
>
> Did you mean something else?
>
> -Peff
>
Previous: Jeff KingNext: Jeff King
Message 6 of 9 in “HowTo distribute a hook with the reposity.”
  1. John P. HartmannDec 28, 2016
  2. Jacob KellerDec 28, 2016
  3. Jeff KingDec 28, 2016
  4. John P. HartmannDec 28, 2016
  5. Jeff KingDec 28, 2016
  6. John P. HartmannDec 28, 2016
  7. Jeff KingDec 28, 2016
  8. Jacob KellerDec 28, 2016
  9. Lars SchneiderDec 29, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.