-
Notifications
You must be signed in to change notification settings - Fork 52
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
implement GPG signing behavior #78
Conversation
Haven't had the time to set up a test yet. I need to set up git config file generation and use the |
ghstack/gpg_sign.py
Outdated
try: | ||
# Why the complicated compare | ||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-boolean | ||
should_sign = shell.git("config", "--get", "commit.gpgsign") in ("yes", "on", "true", "1") |
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.
Probably should cache this so we don't keep whacking git config
This looks pretty good! A test would be great. |
add test
d002bc3
to
238eb37
Compare
@ezyang Added a test to make sure are are adding |
ghstack/gpg_sign.py
Outdated
# Why the complicated compare | ||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-boolean | ||
_should_sign = shell.git("config", "--get", "commit.gpgsign") in ("yes", "on", "true", "1") | ||
print(_should_sign) |
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.
leftover debug printf
test_ghstack.py
Outdated
]) | ||
# Set the env var | ||
config = os.environ.get("GIT_CONFIG", None) | ||
os.environ["GIT_CONFIG"] = f.name |
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.
Modifying os.environ is generally frowned upon because it is global state that affects the rest of the process. So it would be better if os.environ was as an explicit argument to main(), so that we can more easily replace its contents when testing (as is the case here). Unfortunately, this is not the case, and I shouldn't really be asking you to do the free work of refactoring all of those sites haha. So I'll probably just take this as is.
old test for future reference Lines 2086 to 2125 in bb84c55
|
|
||
|
||
def gpg_args_if_necessary( | ||
shell: ghstack.shell.Shell = ghstack.shell.Shell() |
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.
once we have some sort of env plumbing, would feed env into this function and that would make it possible to override this setting in testing
follow up issue at #80 |
This PR implements GPG signing behavior in ghstack.
This implementation mimics the behavior of git.
This PR resolves #77