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

plumbing/storer: add RemoveReference #269

Merged
merged 1 commit into from
Feb 20, 2017
Merged

plumbing/storer: add RemoveReference #269

merged 1 commit into from
Feb 20, 2017

Conversation

smola
Copy link
Collaborator

@smola smola commented Feb 13, 2017

No description provided.

return nil
}

if err := s.Err(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this check must go before 350, so in case of error and not found we actually return the error instead of nil.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 done

return err
}

backupPackedRefs := packedRefsPath + ".bkp"
Copy link
Contributor

@alcortesm alcortesm Feb 13, 2017

Choose a reason for hiding this comment

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

This function is already too long.

This last part is a very good candidate to be moved to a function called safeRename() or something similar. A good name will also help the reader to tell what 3 consecutive renames do :).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've just removed this and used billy's Rename directly. Doing our own SafeRename external to billy gets messy really fast (since guarantees depend both on operating system, file system and billy Filesystem implementation). So let's rely on billy implementations to provide guarantees as strong as they can on their own.

@codecov-io
Copy link

codecov-io commented Feb 14, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@f5a9c7e). Click here to learn what that means.
The diff coverage is 56.6%.

@@            Coverage Diff            @@
##             master     #269   +/-   ##
=========================================
  Coverage          ?   76.38%           
=========================================
  Files             ?      111           
  Lines             ?     7605           
  Branches          ?        0           
=========================================
  Hits              ?     5809           
  Misses            ?     1161           
  Partials          ?      635
Impacted Files Coverage Δ
plumbing/storer/reference.go 52.94% <ø> (ø)
storage/memory/storage.go 96.46% <100%> (ø)
storage/filesystem/reference.go 81.81% <100%> (ø)
storage/filesystem/internal/dotgit/dotgit.go 69.86% <52.08%> (ø)

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 f5a9c7e...53385d6. Read the comment docs.

@@ -18,6 +18,7 @@ type ReferenceStorer interface {
SetReference(*plumbing.Reference) error
Reference(plumbing.ReferenceName) (*plumbing.Reference, error)
IterReferences() (ReferenceIter, error)
RemoveReference(plumbing.ReferenceName) error
Copy link
Contributor

Choose a reason for hiding this comment

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

Some documentation indicating at least that could not be thread safe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Being thread-safe or not is implementation-dependent. So far, none of our public implementations is thread-safe for any write operation.

@mcuadros mcuadros merged commit efe9ecf into src-d:master Feb 20, 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.

5 participants