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

Re: Bug: 'git ls-files' doesn't work on submodule in post-commit hook

From
SStefan <git.kernel.org_20@green-sparklet.de>
Date
Feb 25, 2020, 07:10 UTC
Message-ID
<539bac71-a4af-f96c-ae08-e8fa659c5dd1@green-sparklet.de>
In-Reply-To
<20200225011320.GL6462@camp.crustytoothpaste.net>
Hi brian,

I checked it by replacing the printf line in my example with this one: printf '#!/bin/bash\necho GIT_DIR is: $GIT_DIR\ncd git-submodulerepo\necho Git says my files are:\ngit ls-files\necho ---------------\necho Filesystem says my files are:\nls -w1\necho ---------------\n' > .git/hooks/post-commit

In both hooks, GIT_DIR is empty, so this shouldn't be the problem. Thanks anyways.

On 2020-02-25 02:13, brian m. carlson wrote:
Show 5 quoted lines
> Can you check to see if the GIT_DIR environment variable is set in your
> hook?  In some cases, Git sets various GIT_* environment variables when
> calling a hook or command, and if you want another repository, you'd
> need to unset those values.
> 
Previous: brian m. carlson
Message 3 of 3 in “Bug: 'git ls-files' doesn't work on submodule in post-commit hook”
  1. StefanFeb 24, 2020
  2. brian m. carlsonFeb 25, 2020
  3. StefanFeb 25, 2020

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.