-
Notifications
You must be signed in to change notification settings - Fork 552
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
signing with login shell #5910
base: master
Are you sure you want to change the base?
signing with login shell #5910
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@Byron is attempting to deploy a commit to the GitButler Team on Vercel. A member of the Team first needs to authorize it. |
Some parts of `git configuration` aren't implemented in `git2`, and it's the kind of configuration that's typically used to configure signing keys dynamically.
That way it should pick up all configuration just as it does when invoking it from the terminal.
22b230a
to
69d4472
Compare
It's a fully fledged implementation that should be able to pick up additional special cases. Useful for users who configure things per repository.
69d4472
to
f4f26dc
Compare
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.
I definitely changed more than originally planned, as I also added gix
to read Git configuration. As it fully implements Git configuration, it will pick up more 'special' configuration that users might have to adjust their signing keys based on the repository at hand. git2
doesn't implement hasconfig
.
Also note the config.trusted_program()
calls which is gitoxide
s way of assuring no configuration of untrusted users (i.e. all others) is picked up to define which program to execute automatically.
pub fn command_with_login_shell(shell_cmd: impl Into<OsString>) -> std::process::Command { | ||
gix::command::prepare(shell_cmd) | ||
.with_shell_disallow_manual_argument_splitting() | ||
.with_shell_program(std::env::var_os("SHELL").unwrap_or("bash".into())) |
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 is how the hooks crate does it as well and it seems to work for hooks.
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.
@Byron Do we need to the same windows bash.exe lookup that the git2_hooks does?
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.
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.
I didn't see any basic stuff that seemed wrong or incorrect to me.
Use a login shell for spawning the programs to sign a buffer.
Related to #5839 and #5022.
Tasks
gix
for all Git configurationNotes for the Reviewer
Research
Environment variables in a release application
Launching a release application on MacOS (through the finder) yields the following environment variables.
It looks like
$SHELL
can be used to figure out the login shell at least on MacOS. It's notable how many other additional variables are available, as if it was opened through a login shell already.It really seems that a lot, but not all, of the login shell environment is picked up. It's unclear why