This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Expand file tree Collapse file tree 1 file changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,35 @@ func (s *WorktreeSuite) testCheckoutBisect(c *C, url string) {
307
307
})
308
308
}
309
309
310
+ func (s * WorktreeSuite ) TestCheckoutWithGitignore (c * C ) {
311
+ fs := memfs .New ()
312
+ w := & Worktree {
313
+ r : s .Repository ,
314
+ fs : fs ,
315
+ }
316
+
317
+ err := w .Checkout (& CheckoutOptions {})
318
+ c .Assert (err , IsNil )
319
+
320
+ f , _ := fs .Create ("file" )
321
+ f .Close ()
322
+
323
+ err = w .Checkout (& CheckoutOptions {})
324
+ c .Assert (err .Error (), Equals , "worktree contains unstagged changes" )
325
+
326
+ f , _ = fs .Create (".gitignore" )
327
+ f .Write ([]byte ("file" ))
328
+ f .Close ()
329
+
330
+ err = w .Checkout (& CheckoutOptions {})
331
+ c .Assert (err .Error (), Equals , "worktree contains unstagged changes" )
332
+
333
+ w .Add (".gitignore" )
334
+
335
+ err = w .Checkout (& CheckoutOptions {})
336
+ c .Assert (err , IsNil )
337
+ }
338
+
310
339
func (s * WorktreeSuite ) TestStatus (c * C ) {
311
340
fs := memfs .New ()
312
341
w := & Worktree {
@@ -458,10 +487,7 @@ func (s *WorktreeSuite) TestStatusModified(c *C) {
458
487
}
459
488
460
489
func (s * WorktreeSuite ) TestStatusIgnored (c * C ) {
461
- dir , _ := ioutil .TempDir ("" , "status" )
462
- defer os .RemoveAll (dir )
463
-
464
- fs := osfs .New (filepath .Join (dir , "worktree" ))
490
+ fs := memfs .New ()
465
491
w := & Worktree {
466
492
r : s .Repository ,
467
493
fs : fs ,
You can’t perform that action at this time.
0 commit comments