Skip to content

Commit

Permalink
fix: make plugin update work with libgit2 (#3519)
Browse files Browse the repository at this point in the history
I really have no clue what I am doing here but this seems to function

Fixes #3517
  • Loading branch information
jdx authored Dec 13, 2024
1 parent ba51949 commit dd01ac1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ impl Git {
gitref: &str,
) -> Result<(String, String)> {
let mut fetch_options = get_fetch_options()?;
let mut remote = repo.find_remote("origin")?;
let remote_name = "origin";
let mut remote = repo.find_remote(remote_name)?;
remote.fetch(&[gitref], Some(&mut fetch_options), None)?;
let prev_rev = self.current_sha()?;
let (obj, reference) = repo.revparse_ext(gitref)?;
let refname = format!("{remote_name}/{gitref}");
let (obj, reference) = repo.revparse_ext(&refname)?;
repo.checkout_tree(&obj, None)?;
let commit = obj.peel_to_commit()?;
repo.branch(gitref, &commit, true)?;
if let Some(reference) = reference.and_then(|r| r.name().map(|s| s.to_string())) {
repo.set_head(&reference)?;
}
Expand Down

0 comments on commit dd01ac1

Please sign in to comment.