[OpenSmalltalk/opensmalltalk-vm] Second attempt to improve updateSCCSVersions (#227)
I finally got around to solve the "not a git repository" issue with my previous pull request. For the analysis see below. Please review and try it out before merging.
When the script is run as a hook, the environment variable GIT_DIR is set to .git (path relative to the working tree) for regular repositories. This affects the behavior of rev-parse. When the script is run from the working tree and the checkout commands towards the bottom are executed, the script actually invokes itself as the post-checkout script. During that inner invocation, the script would cd to .git/hooks, and because of the GIT_DIR variable, rev-parse would then look for the git repository in .git/hooks/.git. This failed, of course.
The second error message "unrecognized input" came from git apply when it was fed with empty input (because there were no uncommitted changes to either *Version.h file).
Since GIT_DIR caused the trouble, why not use it to detect whether the script is run as a hook...
You can view, comment on, or merge this pull request online at: