Skip to content

Commit 8499233

Browse files
committed
fix conflicts
1 parent 6a884d1 commit 8499233

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
* add `use_selection_fg` to theme file to allow customizing selection foreground color [[@Upsylonbare](https://github.com/Upsylonbare)] ([#2515](https://github.com/gitui-org/gitui/pull/2515))
1616

1717
### Changed
18+
* Stash pop removes stash from list even when there are conflicts([#2372](https://github.com/extrawurst/gitui/issues/2372))
1819
* improve syntax highlighting file detection [[@acuteenvy](https://github.com/acuteenvy)] ([#2524](https://github.com/extrawurst/gitui/pull/2524))
1920
* Updated project links to point to `gitui-org` instead of `extrawurst` [[@vasleymus](https://github.com/vasleymus)] ([#2538](https://github.com/gitui-org/gitui/pull/2538))
2021
* After commit: jump back to unstaged area [[@tommady](https://github.com/tommady)] ([#2476](https://github.com/extrawurst/gitui/issues/2476))

asyncgit/src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub enum Error {
2121
#[error("git: conflict during rebase")]
2222
RebaseConflict,
2323

24+
///
25+
#[error("git: conflict during stash apply")]
26+
StashApplyConflict,
27+
2428
///
2529
#[error("git: remote url not found")]
2630
UnknownRemote,

asyncgit/src/sync/stash.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,21 @@ pub fn stash_pop(
5050

5151
let index = get_stash_index(&mut repo, stash_id.into())?;
5252

53-
repo.stash_pop(index, None)?;
53+
// todo: The allow_conflicts parameter set in CheckoutBuilder is not actually taking effect.
54+
let mut checkout = CheckoutBuilder::new();
55+
checkout.allow_conflicts(false);
56+
57+
let mut opt = StashApplyOptions::default();
58+
opt.checkout_options(checkout);
59+
repo.stash_apply(index, None)?;
60+
61+
// check for merge conflicts
62+
if repo.index()?.has_conflicts() {
63+
return Err(Error::StashApplyConflict);
64+
}
65+
66+
// remove the entry at the specified index from the stash list
67+
repo.stash_drop(index)?;
5468

5569
Ok(())
5670
}

0 commit comments

Comments
 (0)