diff options
author | Paulo Gomes <pjbgf@linux.com> | 2023-03-07 22:08:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 22:08:21 +0000 |
commit | 3f1cfde283c93f33218c807602e93d47f72f7b90 (patch) | |
tree | 79ca079e152908d61f85c229d3b5c52f3afb829b /storage/filesystem/dotgit/dotgit.go | |
parent | 8557a36bc5b1b154c02f6d1deef68fc21f04b128 (diff) | |
parent | 660071d48cfe9728953e4a84960d40deb7078811 (diff) | |
download | go-git-3f1cfde283c93f33218c807602e93d47f72f7b90.tar.gz |
Merge pull request #659 from MichaelMure/dotgit-racev5.6.1
dotgit: fix a filesystem race in Refs/walkReferencesTree
Diffstat (limited to 'storage/filesystem/dotgit/dotgit.go')
-rw-r--r-- | storage/filesystem/dotgit/dotgit.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/storage/filesystem/dotgit/dotgit.go b/storage/filesystem/dotgit/dotgit.go index 6c386f7..2be2bae 100644 --- a/storage/filesystem/dotgit/dotgit.go +++ b/storage/filesystem/dotgit/dotgit.go @@ -943,6 +943,7 @@ func (d *DotGit) walkReferencesTree(refs *[]*plumbing.Reference, relPath []strin files, err := d.fs.ReadDir(d.fs.Join(relPath...)) if err != nil { if os.IsNotExist(err) { + // a race happened, and our directory is gone now return nil } @@ -960,6 +961,10 @@ func (d *DotGit) walkReferencesTree(refs *[]*plumbing.Reference, relPath []strin } ref, err := d.readReferenceFile(".", strings.Join(newRelPath, "/")) + if os.IsNotExist(err) { + // a race happened, and our file is gone now + continue + } if err != nil { return err } |