From: Stefan Date: Tue, 25 Feb 2020 07:10:52 GMT Subject: Re: Bug: 'git ls-files' doesn't work on submodule in post-commit hook 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: > 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. >