File tree 3 files changed +20
-1
lines changed
3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
* use default shell instead of bash on Unix-like OS [[ @yerke ] ( https://github.com/yerke )] ([ #2343 ] ( https://github.com/extrawurst/gitui/pull/2343 ) )
12
12
13
13
### Fixes
14
+ * Stash pop removes stash from list even when there are conflicts([ #2372 ] ( https://github.com/extrawurst/gitui/issues/2372 ) )
14
15
* respect env vars like ` GIT_CONFIG_GLOBAL ` ([ #2298 ] ( https://github.com/extrawurst/gitui/issues/2298 ) )
15
16
* Set ` CREATE_NO_WINDOW ` flag when executing Git hooks on Windows ([ #2371 ] ( https://github.com/extrawurst/gitui/pull/2371 ) )
16
17
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ pub enum Error {
21
21
#[ error( "git: conflict during rebase" ) ]
22
22
RebaseConflict ,
23
23
24
+ ///
25
+ #[ error( "git: conflict during stash apply" ) ]
26
+ StashApplyConflict ,
27
+
24
28
///
25
29
#[ error( "git: remote url not found" ) ]
26
30
UnknownRemote ,
Original file line number Diff line number Diff line change @@ -50,7 +50,21 @@ pub fn stash_pop(
50
50
51
51
let index = get_stash_index ( & mut repo, stash_id. into ( ) ) ?;
52
52
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) ?;
54
68
55
69
Ok ( ( ) )
56
70
}
You can’t perform that action at this time.
0 commit comments