-
Notifications
You must be signed in to change notification settings - Fork 534
Worktree.Reset refactor and Soft, Merge, Hard and Mixed modes #572
Conversation
Codecov Report
@@ Coverage Diff @@
## master #572 +/- ##
==========================================
- Coverage 78.01% 77.45% -0.56%
==========================================
Files 129 129
Lines 9855 9895 +40
==========================================
- Hits 7688 7664 -24
- Misses 1328 1405 +77
+ Partials 839 826 -13
Continue to review full report at Codecov.
|
submodule.go
Outdated
@@ -90,7 +93,7 @@ func (s *Submodule) status(idx *index.Index) (*SubmoduleStatus, error) { | |||
err = nil | |||
} | |||
|
|||
return status, err | |||
return status, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we intentionally discarding the error here? If so, the previous if can be removed.
name = ch.From.String() | ||
} | ||
|
||
_, _ = idx.Remove(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this operation fail? If so, should we leave it unhandled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the only error returned by Remove, is ErrEntryNotFound
and we don't care about it.
if err := w.rmIndexFromFile(name, idx); err != nil { | ||
return err | ||
} | ||
_, _ = idx.Remove(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, should we ignore this error?
@@ -503,6 +556,7 @@ func (w *Worktree) checkoutFileSymlink(f *object.File) (err error) { | |||
} | |||
|
|||
func (w *Worktree) addIndexFromTreeEntry(name string, f *object.TreeEntry, idx *index.Index) error { | |||
_, _ = idx.Remove(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -513,6 +567,7 @@ func (w *Worktree) addIndexFromTreeEntry(name string, f *object.TreeEntry, idx * | |||
} | |||
|
|||
func (w *Worktree) addIndexFromFile(name string, h plumbing.Hash, idx *index.Index) error { | |||
_, _ = idx.Remove(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
Fixes #435 #415