Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Stefan <git.kernel.org_20@green-sparklet.de>
Cc: git@vger.kernel.org
Subject: Re: Bug: 'git ls-files' doesn't work on submodule in post-commit hook
Date: Tue, 25 Feb 2020 01:13:20 +0000	[thread overview]
Message-ID: <20200225011320.GL6462@camp.crustytoothpaste.net> (raw)
In-Reply-To: <ede4b653-35bf-d163-c27d-d23602dbd726@green-sparklet.de>

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2020-02-25  1:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-24  7:03 Bug: 'git ls-files' doesn't work on submodule in post-commit hook Stefan
2020-02-25  1:13 ` brian m. carlson [this message]
2020-02-25  7:10   ` Stefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200225011320.GL6462@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git.kernel.org_20@green-sparklet.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox