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

storage: filesystem, clean close when the packfile is not used #140

Merged
merged 1 commit into from
Nov 28, 2016
Merged

storage: filesystem, clean close when the packfile is not used #140

merged 1 commit into from
Nov 28, 2016

Conversation

mcuadros
Copy link
Contributor

This PR try to fix #126

If not fixed this problem directly, is a step towards.

When the PackWriter was created and not used, the temp file was keep. Also an error was returned because a empty packfile was read

@@ -72,34 +78,58 @@ func (w *PackWriter) buildIndex() {
w.result <- err
}

func (w *PackWriter) Write(p []byte) (n int, err error) {
// waitBuildIndex waits until buildIndex function finish, this can terminate
Copy link
Collaborator

Choose a reason for hiding this comment

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

finish -> finishes

@@ -72,34 +78,58 @@ func (w *PackWriter) buildIndex() {
w.result <- err
}

func (w *PackWriter) Write(p []byte) (n int, err error) {
// waitBuildIndex waits until buildIndex function finish, this can terminate
// with with a packfile.ErrEmptyPackfile, this means that nothing was written
Copy link
Collaborator

Choose a reason for hiding this comment

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

with with -> with

return w.synced.Write(p)
}

// Close close all the file descriptors and save the final packfile, if nothing
Copy link
Collaborator

Choose a reason for hiding this comment

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

close -> closes

@mcuadros mcuadros merged commit 7cee84e into src-d:master Nov 28, 2016
@mcuadros mcuadros deleted the packwriter-fix-empty branch December 13, 2016 10:13
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.

pulling on existing repository with no changes produces new packfile
2 participants