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

Re: bug report

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 25, 2022, 18:12 UTC
Message-ID
<CAPig+cQEC6CAV-Es9Ok96s8Cj=Dj76PRyOt4qKQus+rppswuyA@mail.gmail.com>
In-Reply-To
<CAL_N1vv1KqojvaS7TSeJ1JnUfO=cSzfUNMhGzgLi2pLUrmMWxQ@mail.gmail.com>
On Sun, Dec 25, 2022 at 12:48 PM Eyal Post <eyalpost@gmail.com> wrote:
Show 9 quoted lines
> 1. I have a script which creates a git worktree and checks out a few
> files from the master branch
> 2. When this script runs "stand alone" - everything works fine
> 3. When this script runs from a "pre-commit" hook it fails with an
> error: "fatal: Unable to create '/tmp/wt-1/.git/index.lock': Not a
> directory"
>
> The content of the script is (simplified example):
> git worktree add /tmp/wt-1 master --no-checkout --detach

This was previously reported[1]. Based upon a quick scan of that old email thread, I'm not sure we ever came to a final conclusion about whether Git could address this case itself[2] without breaking existing workflows or if it should be the hook's responsibility[3]. Perhaps try having your hook script unset environment variables as explained in [3], or at minimum unset GIT_INDEX_FILE. Also, perhaps this advice[4] applies and you can take a simpler, less heavyweight approach to whatever your hook is doing.

[1]: https://lore.kernel.org/git/CAJFQqN+Z9eX6onaj8vVSqpvf-nOC7-Y0Un4NLUie6x6bGfmvZA@mail.gmail.com/ [2]: https://lore.kernel.org/git/20190517011941.GA30372@sigill.intra.peff.net/ [3]: https://lore.kernel.org/git/20190516221702.GA11784@sigill.intra.peff.net/ [4]: https://lore.kernel.org/git/CAGyf7-GtnCqfqPWVpBAELB4xAE6syn7+DfKXgfhL0UoMfvbn4A@mail.gmail.com/

Previous: Eyal Post
Message 2 of 2 in “bug report”
  1. Eyal PostDec 25, 2022
  2. Eric SunshineDec 25, 2022

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.