Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Go back to $this->user->toArray()
As I can't make $this->user->email() work.
knut-forkalsrud authored Jan 8, 2019
commit 7a93cf78ffa643c969aa83c2de74591c920f4006
3 changes: 2 additions & 1 deletion addons/Spock/Git.php
Original file line number Diff line number Diff line change
@@ -86,7 +86,8 @@ protected function commitCommand()
* i.e, "--author=A U Thor <author@example.com>"
*/
protected function author() {
Copy link
Contributor

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

Copy link
Author

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.

return sprintf('--author=%s <%s>', $this->user->name(), $this->user->email());
$user = $this->user->toArray();
return sprintf("--author=%s <%s>", $user['name'], $user['email']);
Copy link
Contributor

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()

Copy link
Author

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.

}