@@ -83,6 +83,7 @@ public override Task<bool> Sure()
8383 _repo . SetWatcherEnabled ( false ) ;
8484 return Task . Run ( ( ) =>
8585 {
86+ var succ = false ;
8687 if ( CheckoutAfterCreated )
8788 {
8889 var changes = new Commands . CountLocalChangesWithoutUntracked ( _repo . FullPath ) . Result ( ) ;
@@ -92,7 +93,7 @@ public override Task<bool> Sure()
9293 if ( PreAction == Models . DealWithLocalChanges . StashAndReaply )
9394 {
9495 SetProgressDescription ( "Stash local changes" ) ;
95- var succ = new Commands . Stash ( _repo . FullPath ) . Push ( "CREATE_BRANCH_AUTO_STASH" ) ;
96+ succ = new Commands . Stash ( _repo . FullPath ) . Push ( "CREATE_BRANCH_AUTO_STASH" ) ;
9697 if ( ! succ )
9798 {
9899 CallUIThread ( ( ) => _repo . SetWatcherEnabled ( true ) ) ;
@@ -109,7 +110,7 @@ public override Task<bool> Sure()
109110 }
110111
111112 SetProgressDescription ( $ "Create new branch '{ _name } '") ;
112- new Commands . Checkout ( _repo . FullPath ) . Branch ( _name , _baseOnRevision , SetProgressDescription ) ;
113+ succ = new Commands . Checkout ( _repo . FullPath ) . Branch ( _name , _baseOnRevision , SetProgressDescription ) ;
113114
114115 if ( needPopStash )
115116 {
@@ -120,17 +121,24 @@ public override Task<bool> Sure()
120121 else
121122 {
122123 SetProgressDescription ( $ "Create new branch '{ _name } '") ;
123- Commands . Branch . Create ( _repo . FullPath , _name , _baseOnRevision ) ;
124+ succ = Commands . Branch . Create ( _repo . FullPath , _name , _baseOnRevision ) ;
124125 }
125126
126127 CallUIThread ( ( ) =>
127128 {
128- if ( CheckoutAfterCreated && _repo . HistoriesFilterMode == Models . FilterMode . Included )
129+ if ( succ && CheckoutAfterCreated && _repo . HistoriesFilterMode == Models . FilterMode . Included )
130+ {
131+ _repo . Settings . HistoriesFilters . Clear ( ) ;
129132 _repo . Settings . UpdateHistoriesFilter ( $ "refs/heads/{ _name } ", Models . FilterType . LocalBranch , Models . FilterMode . Included ) ;
130133
134+ if ( BasedOn is Models . Branch b && ! b . IsLocal )
135+ _repo . Settings . UpdateHistoriesFilter ( b . FullName , Models . FilterType . LocalBranch , Models . FilterMode . Included ) ;
136+ }
137+
131138 _repo . MarkBranchesDirtyManually ( ) ;
132139 _repo . SetWatcherEnabled ( true ) ;
133140 } ) ;
141+
134142 return true ;
135143 } ) ;
136144 }
0 commit comments