refactor(git): 移除重复的 git commit 命令并添加 tempfile 导入
This commit is contained in:
@@ -2,6 +2,7 @@ use anyhow::{bail, Context, Result};
|
|||||||
use git2::{Repository, Signature, StatusOptions, Config, Oid, ObjectType};
|
use git2::{Repository, Signature, StatusOptions, Config, Oid, ObjectType};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use tempfile;
|
||||||
|
|
||||||
pub mod changelog;
|
pub mod changelog;
|
||||||
pub mod commit;
|
pub mod commit;
|
||||||
@@ -367,11 +368,6 @@ impl GitRepo {
|
|||||||
let temp_file = tempfile::NamedTempFile::new()?;
|
let temp_file = tempfile::NamedTempFile::new()?;
|
||||||
std::fs::write(temp_file.path(), message)?;
|
std::fs::write(temp_file.path(), message)?;
|
||||||
|
|
||||||
let mut cmd = std::process::Command::new("git");
|
|
||||||
cmd.args(&["commit", "-S", "-F", temp_file.path().to_str().unwrap()])
|
|
||||||
.current_dir(&self.path)
|
|
||||||
.output()?;
|
|
||||||
|
|
||||||
let output = std::process::Command::new("git")
|
let output = std::process::Command::new("git")
|
||||||
.args(&["commit", "-S", "-F", temp_file.path().to_str().unwrap()])
|
.args(&["commit", "-S", "-F", temp_file.path().to_str().unwrap()])
|
||||||
.current_dir(&self.path)
|
.current_dir(&self.path)
|
||||||
|
|||||||
Reference in New Issue
Block a user