-
Notifications
You must be signed in to change notification settings - Fork 89
fix: create hooks dir, when hooks dir not exists #5
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
Conversation
Hey, this is pretty useful. Thanks |
src/Commands/AddCommand.php
Outdated
$hookDir = "{$gitDir}/hooks"; | ||
|
||
if (! is_dir($hookDir)) { | ||
mkdir($hookDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would fail if the gitDir
folder does not already exist. We need to make the mkdir
recursive. Do you mind fixing that? You can get more info here. Or you can look at how the git hooks folders were created in the AddCommand
and UpdateCommand
tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/Hook.php
Outdated
@@ -22,10 +22,19 @@ public static function getValidHooks() | |||
); | |||
$validHooks = []; | |||
|
|||
//add customize hooks | |||
$customizeHooks = isset($json['extra']['customize_hooks']) ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to define some hooks except applypatch-msg
,commit-msg
and so on. eg: ctags hook order to read source code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how will you integrate the custom hooks into git?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My git config:
[alias]
st = status
.....
# this line
ctags = !.git/hooks/ctags
i can git ctags
in the my project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, while that's great, it's not technically a git hook. It's a script that you're aliasing to a git command. So, it's not really in the scope of this project. Don't you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. This project is order to create some scripts for git, some scripts been known as git hooks. So, i think it can add custom hooks. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, git hooks are more than just scripts. They are tied into git's event system and run only when an event occurs, so custom ones don't really make sense. A read about git hooks.
Anyway, I would appreciate it if you could remove that commit for now, since it's not really tied to the original feature you were implementing. Then I can merge, and we can talk about the custom hooks in a separate PR. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, i revert that commit.
…hod for AddCommand and UpdateCo
This reverts commit ec50b9b.
Thanks! |
create
.git/hooks
dir, when.git/hooks
dir is not exists.