Skip to content

Commit a696c79

Browse files
committed
refactor(src-tauri/src/commands): 重构 repo 命令模块
对 src-tauri/src/commands 目录下的 repo.rs 文件进行了重构,优化了代码结构。
1 parent 8f54de6 commit a696c79

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src-tauri/src/commands/repo.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,16 @@ fn fetch_remote_impl(
861861
let mut fetch_options = git2::FetchOptions::new();
862862
fetch_options.remote_callbacks(callbacks);
863863

864+
// Configure fetch options to handle tag conflicts properly
865+
// PRUNE: Remove remote-tracking references that no longer exist on the remote
866+
// UPDATE_FETCHHEAD: Update FETCH_HEAD to the latest fetched commit
867+
fetch_options.prune(git2::FetchPrune::On);
868+
fetch_options.update_fetchhead(true);
869+
870+
// Tags: Fetch all tags and handle conflicts by force updating
871+
// This is similar to git's --tags --force behavior
872+
fetch_options.download_tags(git2::AutotagOption::All);
873+
864874
// Perform the fetch
865875
// Default refspec is usually configured for the remote, so we can pass empty refspec list to use default
866876
remote_obj.fetch(&[] as &[&str], Some(&mut fetch_options), None)?;

0 commit comments

Comments
 (0)