Skip to content

Fix #6013 #6028

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

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
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
10 changes: 6 additions & 4 deletions crates/gitbutler-repo/src/repository_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,13 @@ impl RepositoryExt for git2::Repository {
}

let args = format!(
"{} -U {}",
"'{}' -U '{}'",
key_storage.path().to_string_lossy(),
buffer_file_to_sign_path_str,
);
cmd_string += &args;
} else {
let args = format!("{} {}", signing_key, buffer_file_to_sign_path_str);
let args = format!("'{}' '{}'", signing_key, buffer_file_to_sign_path_str);
cmd_string += &args;
};
let mut signing_cmd: std::process::Command = command_with_login_shell(cmd_string);
Expand Down Expand Up @@ -581,11 +581,13 @@ impl RepositoryExt for git2::Repository {
}

pub fn command_with_login_shell(shell_cmd: impl Into<OsString>) -> std::process::Command {
gix::command::prepare(shell_cmd)
let cmd: std::process::Command = gix::command::prepare(shell_cmd)
.with_shell_disallow_manual_argument_splitting()
// On Windows, this yields the Git-bundled `sh.exe`, on Linux it uses `/bin/sh`.
.with_shell_program(gix::path::env::shell())
.into()
.into();
tracing::debug!(?cmd, "command to produce commit signature");
cmd
}

/// Signs the buffer with the configured gpg key, returning the signature.
Expand Down
Loading