File tree Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Expand file tree Collapse file tree 2 files changed +21
-9
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ static GITIGNORE: &str = ".gitignore";
8
8
/// add file or path to root ignore file
9
9
pub fn add_to_ignore (
10
10
repo_path : & str ,
11
- path_to_ignore : String ,
11
+ path_to_ignore : & str ,
12
12
) -> Result < ( ) > {
13
13
scope_time ! ( "add_to_ignore" ) ;
14
14
Original file line number Diff line number Diff line change @@ -172,15 +172,27 @@ impl ChangesComponent {
172
172
false
173
173
}
174
174
175
- fn add_to_ignore ( & mut self ) -> Result < bool > {
175
+ fn add_to_ignore ( & mut self ) -> bool {
176
176
if let Some ( tree_item) = self . selection ( ) {
177
- sync:: add_to_ignore ( CWD , tree_item. info . full_path ) ?;
178
- self . queue
179
- . borrow_mut ( )
180
- . push_back ( InternalEvent :: Update ( NeedsUpdate :: ALL ) ) ;
181
- return Ok ( true ) ;
177
+ if let Err ( e) =
178
+ sync:: add_to_ignore ( CWD , & tree_item. info . full_path )
179
+ {
180
+ self . queue . borrow_mut ( ) . push_back (
181
+ InternalEvent :: ShowErrorMsg ( format ! (
182
+ "ignore error:\n {}\n file:\n {:?}" ,
183
+ e, tree_item. info. full_path
184
+ ) ) ,
185
+ ) ;
186
+ } else {
187
+ self . queue . borrow_mut ( ) . push_back (
188
+ InternalEvent :: Update ( NeedsUpdate :: ALL ) ,
189
+ ) ;
190
+
191
+ return true ;
192
+ }
182
193
}
183
- Ok ( false )
194
+
195
+ false
184
196
}
185
197
}
186
198
@@ -306,7 +318,7 @@ impl Component for ChangesComponent {
306
318
if self . is_working_dir
307
319
&& !self . is_empty ( ) =>
308
320
{
309
- Ok ( self . add_to_ignore ( ) ? )
321
+ Ok ( self . add_to_ignore ( ) )
310
322
}
311
323
_ => Ok ( false ) ,
312
324
} ;
You can’t perform that action at this time.
0 commit comments