-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows doesn't allow renaming files that are open (attempt 2) #171
Changes from all commits
642155e
fbf3bc7
933b483
f78baee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,6 +244,8 @@ func (d FSBlobsDir) TrackBlob(path string, src io.ReadCloser) (Blob, error) { | |
|
||
blobs[idx] = Blob{Path: path, Size: fileInfo.Size(), SHA1: sha1} | ||
|
||
tempFile.Close() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any chance for a test for this one? nothing currently fails? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, but what should that test do? This method does defer the close of the temp file, but now the defer close will fail if this line is reached. The defer close isn't checking for failure, so this close is causing a silent failure, but also preventing an error in Windows environments. |
||
|
||
err = d.moveBlobLocally(tempFile.Name(), filepath.Join(d.dirPath, path)) | ||
if err != nil { | ||
return Blob{}, err | ||
|
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.
does this test fail on windows if not changed to have 3 temp files?
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.
This test fails everywhere now without 3 temp files, as the file is being closed on each retry. The real file system is creating a new temp file on each of the 3 retries, but the test was previously only using one temp file for all retries.