From: brian m. carlson Date: Tue, 25 Feb 2020 01:13:20 GMT Subject: Re: Bug: 'git ls-files' doesn't work on submodule in post-commit hook Message-ID: <20200225011320.GL6462@camp.crustytoothpaste.net> In-Reply-To: On 2020-02-24 at 07:03:15, Stefan wrote: > So 'git ls-files' call in post-checkout hook works: > $ git checkout HEAD > A       .gitmodules > A       git-submodulerepo > Git says my files are: > submodule_file.txt > --------------- > Filesystem says my files are: > submodule_file.txt > --------------- >   > A 'git ls-files' in post-commit doesn’t work: > $  echo nothing >> rubbish.txt && git commit rubbish.txt -m "Add just rubbish" > Git says my files are: > --------------- > Filesystem says my files are: > submodule_file.txt > --------------- > [master e05efb1] just rubbish > 1 file changed, 1 insertion(+) 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. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204