feat(changelog): 添加 --no-generate 标志以支持纯模板生成
- 新增 `--no-generate` 参数,强制使用模板生成而非 AI - 调整 `--yes` 参数仅跳过交互提示,不改变生成行为 - 统一使用工具函数替代 println 输出
This commit is contained in:
@@ -76,7 +76,7 @@ fn try_open_repo_with_git2(path: &Path) -> Result<Repository> {
|
||||
.or_else(|_| Repository::discover(&normalized))
|
||||
.or_else(|_| Repository::open(&normalized));
|
||||
|
||||
repo.map_err(|e| anyhow::anyhow!("git2 failed: {}", e))
|
||||
repo.map_err(|e| anyhow::anyhow!("Failed to open repository: {}", e))
|
||||
}
|
||||
|
||||
fn try_open_repo_with_git_cli(path: &Path) -> Result<Repository> {
|
||||
@@ -642,7 +642,7 @@ impl GitRepo {
|
||||
}
|
||||
|
||||
/// Stage all changes including subdirectories, then remove ignored tracked files
|
||||
pub fn stage_all(&self) -> Result<Vec<String>> {
|
||||
pub fn stage_all(&self, messages: &crate::i18n::Messages) -> Result<Vec<String>> {
|
||||
// Use git command for reliable staging (handles all edge cases)
|
||||
let output = std::process::Command::new("git")
|
||||
.args(["add", "-A"])
|
||||
@@ -662,7 +662,11 @@ impl GitRepo {
|
||||
match self.remove_ignored_from_index() {
|
||||
Ok(removed) => Ok(removed),
|
||||
Err(e) => {
|
||||
eprintln!("Warning: failed to clean ignored files from index: {}", e);
|
||||
crate::utils::eprint_warning(&format!(
|
||||
"{}: {}",
|
||||
messages.failed_clean_ignored(),
|
||||
e
|
||||
));
|
||||
Ok(Vec::new())
|
||||
}
|
||||
}
|
||||
@@ -937,16 +941,6 @@ impl GitRepo {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Create GPG signature for arbitrary content
|
||||
fn create_gpg_signature_for_content(
|
||||
&self,
|
||||
_content: &str,
|
||||
_gpg_program: &str,
|
||||
_signing_key: &str,
|
||||
) -> Result<String> {
|
||||
Ok(String::new())
|
||||
}
|
||||
|
||||
/// Delete a tag
|
||||
pub fn delete_tag(&self, name: &str) -> Result<()> {
|
||||
self.repo.tag_delete(name)?;
|
||||
@@ -1515,7 +1509,14 @@ mod tests {
|
||||
let head = repo.repo.head().unwrap().peel_to_commit().unwrap();
|
||||
|
||||
// Create a lightweight tag
|
||||
repo.repo.tag("v0.1.0", head.as_object(), &repo.repo.signature().unwrap(), "", false)
|
||||
repo.repo
|
||||
.tag(
|
||||
"v0.1.0",
|
||||
head.as_object(),
|
||||
&repo.repo.signature().unwrap(),
|
||||
"",
|
||||
false,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let tags = repo.get_tags().unwrap();
|
||||
@@ -1541,7 +1542,13 @@ mod tests {
|
||||
|
||||
// Create lightweight tag
|
||||
repo.repo
|
||||
.tag("v0.1.0", head.as_object(), &repo.repo.signature().unwrap(), "", false)
|
||||
.tag(
|
||||
"v0.1.0",
|
||||
head.as_object(),
|
||||
&repo.repo.signature().unwrap(),
|
||||
"",
|
||||
false,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let tags = repo.get_tags().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user