-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add author to commits #28
base: master
Are you sure you want to change the base?
Conversation
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.
Hey knut
I really like the feature
I added some feedback 😉
*/ | ||
protected function author() { | ||
$user = $this->user->toArray(); | ||
return sprintf("--author=%s <%s>", $user['name'], $user['email']); |
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.
Can you use the getter methods on the User object?
Like $this->user->email()
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, I can't get $this->user->email()
to work... Maybe I'm being dense, but PHP claim there is no such function. I'll go back to the toArray()
approach.
* Create a Git author parameter from the user's name and email address, | ||
* i.e, "--author=A U Thor <[email protected]>" | ||
*/ | ||
protected function author() { |
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 method could be private
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.
Indeed it could be private, however all the other similar methods are protected, so I'd rather follow suit on that.
This reverts commit 891ffa0.
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.
Thank you @rrelmy for the review. I have tried to address the issues you raised. The only proposed changes are now in the construction of "git commit".
* Create a Git author parameter from the user's name and email address, | ||
* i.e, "--author=A U Thor <[email protected]>" | ||
*/ | ||
protected function author() { |
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.
Indeed it could be private, however all the other similar methods are protected, so I'd rather follow suit on that.
As I can't make $this->user->email() work.
Would love to see this added! Is it also possible to have the
|
Git distinguishes between author and committer. The configured
committer details in
site/settings/addons/spock.yaml
are fine,but the Statamic user who is logged in should be credited with
the authorship. The log show both. For example with
spock.yaml
like the example:
And a user (username "bob", first name "Bob", last name "Author", email "[email protected]").
The log will look something like:
This is somewhat opposite to the desires expressed in issue #25, having the commit message itself include something like "[spock]" to distinguish it from typical developer commits. However there is no conflict between this and that. We can do both.
My apologies for breaking all the tests. I'm not really a PHP developer, and my feeble attempt at running the test is greeted with a definite error message:
I may need a pointer to how to run the tests effectively.
Also part of the pull request is a change from looking at "affected paths", and instead commit all outstanding changes. There seems to be an issue with some changes (draft blog entries) not being accurately reflected in "affected paths". Maybe this aspect should have ben a different pull request altogether.
Finally I'm using the standard
escapeshellarg
to escape any potential malicious input to the shell command. I notice commit b4a89a4 is opposite in some ways, but I suspect that is just a workaround for a different culprit.