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) {
307307 })
308308}
309309
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+
310339func (s * WorktreeSuite ) TestStatus (c * C ) {
311340 fs := memfs .New ()
312341 w := & Worktree {
@@ -458,10 +487,7 @@ func (s *WorktreeSuite) TestStatusModified(c *C) {
458487}
459488
460489func (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 ()
465491 w := & Worktree {
466492 r : s .Repository ,
467493 fs : fs ,
You can’t perform that action at this time.
0 commit comments