diff --git a/password/git.go b/password/git.go index a70d952153..1c2f328d4d 100644 --- a/password/git.go +++ b/password/git.go @@ -134,6 +134,9 @@ func (s *Store) gitAdd(files ...string) error { if !s.isGit() { return ErrGitNotInit } + for i := range files { + files[i] = strings.TrimPrefix(files[i], s.path+"/") + } args := []string{"add", "--all"} args = append(args, files...) diff --git a/password/store.go b/password/store.go index 7ff01e9c39..a9aa1ef303 100644 --- a/password/store.go +++ b/password/store.go @@ -400,16 +400,17 @@ func (s *Store) Prune(tree string) error { func (s *Store) delete(name string, recurse bool) error { path := s.passfile(name) rf := os.Remove - if recurse { - path = filepath.Join(s.path, name) - rf = os.RemoveAll - } if !recurse && !fsutil.IsFile(path) { return ErrNotFound } - if recurse && !fsutil.IsDir(path) { - return ErrNotFound + + if recurse && !fsutil.IsFile(path) { + path = filepath.Join(s.path, name) + rf = os.RemoveAll + if !fsutil.IsDir(path) { + return ErrNotFound + } } if err := rf(path); err != nil {