aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_status.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-05-04 00:09:55 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2017-05-04 00:09:55 +0200
commit5592dabdf9eed67c92b0e411ad375ae763119fd2 (patch)
treed8d41fed6cfdccbb7ac1794fac43c4ec6e7f159e /worktree_status.go
parent2e092f909f643ef455d84dfa59282f0f0adf3c7a (diff)
downloadgo-git-5592dabdf9eed67c92b0e411ad375ae763119fd2.tar.gz
worktree: Status return untracked for untracked files
Diffstat (limited to 'worktree_status.go')
-rw-r--r--worktree_status.go10
1 files changed, 4 insertions, 6 deletions
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
}