New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Give support for hooks based on platform #1069
base: master
Are you sure you want to change the base?
Conversation
The idea behind this commit can be useful for teams that share git-hooks into a custom directory and dealing with projects that must be developed, built, maintained on several different platforms. This commit allows the execution of git hooks based on the current operating system. A "native hook" is defined in the form: hooks/hook-name_platform Where platform must be equivalent to the content returned in sysname field in utsname struct when calling uname() [but all normalized in lowercase]. On Windows, independent of version, flavor, SP, whatever it is simply "windows". When a native hook is not found the standard hook (.git/hook/hook-name), if found is executed, of course. In other words, the hook without a platform postfix (_yyz) is the standard hook. When native hook is not set as executable but standard is set, the standard will be executed. The main motivation of this extension is to reduce dependency of scripting languages, logical trinkets etc just to execute minor tasks during scm events that could be done natively but differently from a platform to another. Less dependencies, cleaner repos: a small step for a better world for any software developer. Signed-off-by: Rafael Santiago <voidbrainvoid@tutanota.com>
Since this is a continuation of #1062, I'd like to point out that force-pushing the PR branch will update the PR, there is not actually a need for opening a new PR 😃 |
The problem was that all git incantation to put mine commits at the top of fixed merged stuff from upstream was becoming tricky and I was not secure about not screw up other people work. So I chose the "lumberjack's solution" of squashing mine changes from my fork, reserve a patch from it, remove my fork and forking again from original git's repo and patch it. When I deleted my prior fork the related PR here was closed I was unable to open it again, so another "lumberjack's solution": open a new one... 😃 |
/submit |
Submitted as pull.1069.git.git.1629576007891.gitgitgadget@gmail.com To fetch this version into
To fetch this version to local tag
|
On the Git mailing list, "brian m. carlson" wrote (reply to this):
|
User |
On the Git mailing list, Rafael Santiago wrote (reply to this):
|
On the Git mailing list, "brian m. carlson" wrote (reply to this):
|
On the Git mailing list, Rafael Santiago wrote (reply to this):
|
On the Git mailing list, Jeff King wrote (reply to this):
|
User |
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Junio C Hamano wrote (reply to this):
|
On the Git mailing list, Jeff King wrote (reply to this):
|
This would be pretty big for me, look forward to cross-platform hooks being easier in the near future 😊 |
The idea behind this commit can be useful for teams that share git-hooks into a custom directory and dealing with projects that must be developed, built, maintained on several different platforms.
This commit allows the execution of git hooks based on the current operating system. A "native hook" is defined in the form: hooks/hook-name_platform
Where platform must be equivalent to the content returned in sysname field in utsname struct when calling uname() [but all normalized in lowercase].
On Windows, independent of version, flavor, SP, whatever it is simply "windows".
When a native hook is not found the standard hook (.git/hook/hook-name), if found is executed, of course. In other words, the hook without a platform postfix (_yyz) is the standard hook. When native hook is not set as executable but standard is set, the
standard will be executed.
The main motivation of this extension is to reduce dependency of scripting languages, logical trinkets etc just to execute minor tasks during scm events that could be done natively but differently from a platform to another. Less dependencies, cleaner
repos: a small step for a better world for any software developer.
cc: "brian m. carlson" sandals@crustytoothpaste.net
cc: Jeff King peff@peff.net