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

Better user handling #264

Merged
merged 5 commits into from Sep 14, 2018
Merged

Better user handling #264

merged 5 commits into from Sep 14, 2018

Conversation

tschaub
Copy link
Owner

@tschaub tschaub commented Sep 14, 2018

When the gh-pages command runs, it creates a repo in a cache directory. By default, this directory is in the gh-pages install directory (e.g. path/to/node_modules/gh-pages/.cache).

Previously, commits that were created in the cached repo used the git config user.email and git config user.name as determined from the cached repo. In the case of a global gh-pages install, this user name and email would most likely be the global git user. In the case of a local gh-pages install, this would be a local git user if one was configured.

This branch changes things so that the user is determined by running git config user.email (and same for name) in the current working directory. This means that the git user will be the local user if the current directory is a git repo and has a locally configured user. Otherwise it will be the global git user.

To override the behavior of determining the git user, a user option can be provided. For the CLI, the format of this option is "Full Name <email@example.com" (see RFC-5322). For example:

gh-pages -d dist --user "Your Name <you@example.com>"

The same behavior applies to programmatic usage. A {name, email} object can be provided for the user option. If not provided, git config user.email will be run in the current working directory.

Thanks to @holloway for initiating this in #229. And to @nuklearfiziks for resurrecting it once and @paulirish for resurrecting it a second time in #261.

@tschaub tschaub merged commit 515b05a into master Sep 14, 2018
@tschaub tschaub deleted the user-option branch September 14, 2018 19:27
@nuklearfiziks
Copy link

This is fantastic; thank you for fixing this!! 👏 🙌 :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants