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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

David T Lewis
 

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@.../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, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"GIT_DIR environment variable is no longer set in git hooks (#389)"}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

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

David T Lewis
 

Closed #389.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Closed #389."}],"action":{"name":"View Issue","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389#event-2272767350"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389#event-2272767350", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/389#event-2272767350", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>