mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-26 11:37:32 +00:00
fix: Pass --no-gpg-sign
to git commit
in tests (#1718)
Some users have commit.gpgSign set to true in their global git config, causing tests which run `git commit` to fail if the configured user.signingKey is not present (as is often the case with PGP smart cards). Passing this flag overrides the global git configuration, preventing git from attempting sign the specified commit. This change has no effect on users who haven't set commit.gpgSign to true.
This commit is contained in:
parent
0883ad78cf
commit
2693d125a8
@ -334,13 +334,17 @@ mod tests {
|
|||||||
// Write a file on master and commit it
|
// Write a file on master and commit it
|
||||||
write_file("Version A")?;
|
write_file("Version A")?;
|
||||||
run_git_cmd(&["add", "the_file"], Some(path), true)?;
|
run_git_cmd(&["add", "the_file"], Some(path), true)?;
|
||||||
run_git_cmd(&["commit", "--message", "Commit A"], Some(path), true)?;
|
run_git_cmd(
|
||||||
|
&["commit", "--message", "Commit A", "--no-gpg-sign"],
|
||||||
|
Some(path),
|
||||||
|
true,
|
||||||
|
)?;
|
||||||
|
|
||||||
// Switch to another branch, and commit a change to the file
|
// Switch to another branch, and commit a change to the file
|
||||||
run_git_cmd(&["checkout", "-b", "other-branch"], Some(path), true)?;
|
run_git_cmd(&["checkout", "-b", "other-branch"], Some(path), true)?;
|
||||||
write_file("Version B")?;
|
write_file("Version B")?;
|
||||||
run_git_cmd(
|
run_git_cmd(
|
||||||
&["commit", "--all", "--message", "Commit B"],
|
&["commit", "--all", "--message", "Commit B", "--no-gpg-sign"],
|
||||||
Some(path),
|
Some(path),
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
@ -349,7 +353,7 @@ mod tests {
|
|||||||
run_git_cmd(&["checkout", "master"], Some(path), true)?;
|
run_git_cmd(&["checkout", "master"], Some(path), true)?;
|
||||||
write_file("Version C")?;
|
write_file("Version C")?;
|
||||||
run_git_cmd(
|
run_git_cmd(
|
||||||
&["commit", "--all", "--message", "Commit C"],
|
&["commit", "--all", "--message", "Commit C", "--no-gpg-sign"],
|
||||||
Some(path),
|
Some(path),
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
|
@ -813,7 +813,7 @@ mod tests {
|
|||||||
.current_dir(&repo_dir.path())
|
.current_dir(&repo_dir.path())
|
||||||
.output()?;
|
.output()?;
|
||||||
Command::new("git")
|
Command::new("git")
|
||||||
.args(&["commit", "-m", "add new files"])
|
.args(&["commit", "-m", "add new files", "--no-gpg-sign"])
|
||||||
.current_dir(&repo_dir.path())
|
.current_dir(&repo_dir.path())
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
@ -842,7 +842,7 @@ mod tests {
|
|||||||
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
File::create(repo_dir.join("readme.md"))?.sync_all()?;
|
||||||
|
|
||||||
Command::new("git")
|
Command::new("git")
|
||||||
.args(&["commit", "-am", "Update readme"])
|
.args(&["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||||
.current_dir(&repo_dir)
|
.current_dir(&repo_dir)
|
||||||
.output()?;
|
.output()?;
|
||||||
barrier();
|
barrier();
|
||||||
@ -870,7 +870,7 @@ mod tests {
|
|||||||
fs::write(repo_dir.join("Cargo.toml"), " ")?;
|
fs::write(repo_dir.join("Cargo.toml"), " ")?;
|
||||||
|
|
||||||
Command::new("git")
|
Command::new("git")
|
||||||
.args(&["commit", "-am", "Update readme"])
|
.args(&["commit", "-am", "Update readme", "--no-gpg-sign"])
|
||||||
.current_dir(repo_dir)
|
.current_dir(repo_dir)
|
||||||
.output()?;
|
.output()?;
|
||||||
barrier();
|
barrier();
|
||||||
@ -894,7 +894,7 @@ mod tests {
|
|||||||
barrier();
|
barrier();
|
||||||
|
|
||||||
Command::new("git")
|
Command::new("git")
|
||||||
.args(&["commit", "-m", "Change readme"])
|
.args(&["commit", "-m", "Change readme", "--no-gpg-sign"])
|
||||||
.current_dir(repo_dir)
|
.current_dir(repo_dir)
|
||||||
.output()?;
|
.output()?;
|
||||||
barrier();
|
barrier();
|
||||||
|
Loading…
Reference in New Issue
Block a user