Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Worktree.Reset refactor and Soft, Merge, Hard and Mixed modes #572

Merged
merged 1 commit into from
Sep 1, 2017
Merged

Worktree.Reset refactor and Soft, Merge, Hard and Mixed modes #572

merged 1 commit into from
Sep 1, 2017

Conversation

mcuadros
Copy link
Contributor

Fixes #435 #415

@mcuadros mcuadros requested a review from erizocosmico August 31, 2017 23:18
@codecov
Copy link

codecov bot commented Sep 1, 2017

Codecov Report

Merging #572 into master will decrease coverage by 0.55%.
The diff coverage is 71.29%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
options.go 84.48% <ø> (ø) ⬆️
worktree.go 66.75% <68.75%> (+1.53%) ⬆️
repository.go 73.87% <75%> (+0.16%) ⬆️
worktree_status.go 74.02% <78.94%> (+0.48%) ⬆️
submodule.go 63.92% <80%> (+0.22%) ⬆️
plumbing/transport/ssh/common.go 20.54% <0%> (-45.21%) ⬇️
plumbing/transport/ssh/auth_method.go 31.57% <0%> (-22.81%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ca3702...f1e58e0. Read the comment docs.

submodule.go Outdated
@@ -90,7 +93,7 @@ func (s *Submodule) status(idx *index.Index) (*SubmoduleStatus, error) {
err = nil
}

return status, err
return status, nil
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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)
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@mcuadros mcuadros merged commit 8ce9f5f into src-d:master Sep 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants