[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] GIT_DIR environment variable is no longer set in git hooks (#389)

Nicolas Cellier notifications at github.com
Thu Apr 11 08:15:49 UTC 2019


With git 2.19 and later I have an error when discarding changes on a modified file (checkout).

The error occurs while executing the .git/hooks/post-checkout and it says:

> cp: '.git/hooks/post-checkout' and '.git/hooks/post-checkout' are the same file

The problem is that GIT_DIR env var is no more set... Thus this codes erroneously think that we are not ran as hook:

    is_run_as_hook() {
        test -n "$GIT_DIR"
    }

It seems that the GIT_DIR change was un-intentional, but the fact that GIT_DIR was set also was un-intentional...
See https://public-inbox.org/git/20180826004150.GA31168@sigill.intra.peff.net/t/

We now must find a way to recognize whether we are ran from a hook or not...
I have asked on SO if ever it can help https://stackoverflow.com/questions/55627720/how-to-recognize-if-git-hook-script-is-really-run-as-a-hook

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20190411/e6eb81fd/attachment.html>


More information about the Vm-dev mailing list