-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add username/email to bare git config in repo #65392
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 username/email to bare git config in repo #65392
Conversation
call_quietly(['git', 'config', 'user.name', 'apple_test'], | ||
cwd=local_repo_path) | ||
call_quietly(['git', 'config', 'user.email', '[email protected]'], | ||
cwd=local_repo_path) |
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.
Will this overwrite local config for the user?
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.
Also, prefer not using apple
. Maybe we can use swift_test
and [email protected]
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.
Will this overwrite local config for the user?
Yes
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.
Will this overwrite local config for the user?
This should only update the configuration for the git repository which is created as part of this test unless I'm misunderstanding. From the git config documentation
When writing, the new value is written to the repository local configuration file by default, and options --system, --global, --worktree, --file can be used to tell the command to write to that location (you can say --local but that is the default).
Also in the output of the error message:
Omit --global to set the identity only in this repository.
As for using the environment variables vs calling git config itself, i have no preference
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.
If those git config commands fail, they'd be ignored (because we are running them through call_quietly
), and we'd still run into the original issue?
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.
@azharudd The commands will raise an exception
def call_quietly(*args, **kwargs):
kwargs['stderr'] = subprocess.STDOUT
try:
subprocess.check_output(*args, **kwargs)
except subprocess.CalledProcessError as e:
raise CallQuietlyException(command=e.cmd, returncode=e.returncode,
output=e.stdout) from e
call_quietly
is intended to suppress stdout from what I'm gathering, not suppress exceptions (a bit confusing)
Instead of executing those
This could be done within that function, and it also doesn't affect the git config. |
@swift-ci test |
@swift-ci test |
* add username/email to bare git config in repo * update mock username/email * remove extra whitespace, fix linter
Add a fake git username/password to the update_checkout tests so they don't fail in differently configured git environments. Currently if a user doesn't have a global email/username setup in their git config the tests will fail with
This PR sets the config for the local mock repository accordingly and ensures that the test is self contained and doesn't rely on the end-users global git environment