diff options
author | Stephen Jung <tummychow511@gmail.com> | 2023-07-26 16:17:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-26 16:17:22 -0400 |
commit | 48f2ab7c1f967e504e1dcd0e81b54822c3bf824c (patch) | |
tree | 547eef7eff99faad3a2a11637785971fa556f84e | |
parent | bca5f29ec4014f559aa6ebe8f788a9c51b9e5cbc (diff) | |
parent | fb9e1b3950ab9b821ad402098c34bac46cfbd453 (diff) |
Merge pull request #92 from rbartlensky/one-fixup-per-commit
Only update head_tree when we commit.
-rw-r--r-- | src/lib.rs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -255,7 +255,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { .iter() .zip(hunks_with_commit.iter().skip(1).map(Some).chain([None])) { - head_tree = apply_hunk_to_tree( + let new_head_tree = apply_hunk_to_tree( &repo, &head_tree, ¤t.hunk_to_apply, @@ -279,9 +279,10 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { .filter(|&msg| summary_counts[msg] == 1) .unwrap_or(&dest_commit_id); let diff = repo - .diff_tree_to_tree(Some(&head_commit.tree()?), Some(&head_tree), None)? + .diff_tree_to_tree(Some(&head_commit.tree()?), Some(&new_head_tree), None)? .stats()?; if !config.dry_run { + head_tree = new_head_tree; head_commit = repo.find_commit(repo.commit( Some("HEAD"), &signature, |