+6
storage/filesystem/dotgit/dotgit.go
+6
storage/filesystem/dotgit/dotgit.go
···
850
850
openFlags |= os.O_CREATE
851
851
}
852
852
853
+
start := time.Now()
853
854
// Keep trying to open and lock the file until we're sure the file
854
855
// didn't change between the open and the lock.
855
856
for {
857
+
// The arbitrary timeout should eventually be replaced with
858
+
// context-based check.
859
+
if time.Since(start) > 15*time.Second {
860
+
return nil, errors.New("timeout trying to lock packed refs")
861
+
}
856
862
f, err = d.fs.OpenFile(packedRefsPath, openFlags, 0600)
857
863
if err != nil {
858
864
if os.IsNotExist(err) && !doCreate {