Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 567d2dc

Browse files
committed
Document Lock+Close usage
1 parent f79423e commit 567d2dc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

storage/filesystem/internal/dotgit/dotgit.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ func (d *DotGit) SetRef(r, old *plumbing.Reference) error {
297297

298298
defer ioutil.CheckClose(f, &err)
299299

300+
// Lock is unlocked by the deferred Close above. This is because Unlock
301+
// does not imply a fsync and thus there would be a race between
302+
// Unlock+Close and other concurrent writers. Adding Sync to go-billy
303+
// could work, but this is better (and avoids superfluous syncs).
300304
err = f.Lock()
301305
if err != nil {
302306
return err

0 commit comments

Comments
 (0)