Skip to content

Commit

Permalink
getting the snapshot diff uses workdir from applied vbranches
Browse files Browse the repository at this point in the history
  • Loading branch information
krlvi committed Jun 11, 2024
1 parent 8e8a0ff commit 119107c
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions crates/gitbutler-core/src/ops/oplog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,20 +528,11 @@ impl Project {
let repo = git2::Repository::init(worktree_dir)?;

let commit = repo.find_commit(sha)?;
// Top tree
let tree = commit.tree()?;
let old_tree = commit.parent(0)?.tree()?;

let wd_tree_entry = tree
.get_name("workdir")
.context("failed to get workdir tree entry")?;
let old_wd_tree_entry = old_tree
.get_name("workdir")
.context("failed to get old workdir tree entry")?;

// workdir tree
let wd_tree = repo.find_tree(wd_tree_entry.id())?;
let old_wd_tree = repo.find_tree(old_wd_tree_entry.id())?;

let wd_tree_id = tree_from_applied_vbranches(&repo, commit.id())?;
let wd_tree = repo.find_tree(wd_tree_id)?;
let old_wd_tree_id = tree_from_applied_vbranches(&repo, commit.parent(0)?.id())?;
let old_wd_tree = repo.find_tree(old_wd_tree_id)?;

// Exclude files that are larger than the limit (eg. database.sql which may never be intended to be committed)
let files_to_exclude =
Expand Down

0 comments on commit 119107c

Please sign in to comment.