From 5592dabdf9eed67c92b0e411ad375ae763119fd2 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Thu, 4 May 2017 00:09:55 +0200 Subject: worktree: Status return untracked for untracked files --- worktree_status.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'worktree_status.go') diff --git a/worktree_status.go b/worktree_status.go index f78a0c2..8dc743d 100644 --- a/worktree_status.go +++ b/worktree_status.go @@ -4,8 +4,6 @@ import ( "bytes" "io" - "fmt" - "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/filemode" "gopkg.in/src-d/go-git.v4/plumbing/format/index" @@ -48,10 +46,13 @@ func (w *Worktree) status(commit plumbing.Hash) (Status, error) { switch a { case merkletrie.Delete: s.File(ch.From.String()).Staging = Deleted + s.File(ch.From.String()).Worktree = Unmodified case merkletrie.Insert: s.File(ch.To.String()).Staging = Added + s.File(ch.To.String()).Worktree = Unmodified case merkletrie.Modify: s.File(ch.To.String()).Staging = Modified + s.File(ch.To.String()).Worktree = Unmodified } } @@ -71,7 +72,6 @@ func (w *Worktree) status(commit plumbing.Hash) (Status, error) { s.File(ch.From.String()).Worktree = Deleted case merkletrie.Insert: s.File(ch.To.String()).Worktree = Untracked - s.File(ch.To.String()).Staging = Untracked case merkletrie.Modify: s.File(ch.To.String()).Worktree = Modified } @@ -179,9 +179,7 @@ func (w *Worktree) Add(path string) (plumbing.Hash, error) { return h, err } - fmt.Println(len(s)) - fs := s.File(path) - if fs != nil && fs.Worktree == Unmodified { + if s.File(path).Worktree == Unmodified { return h, nil } -- cgit