From 63967abe62ecba22a792e728f1af509f3604881f Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 23 Apr 2020 17:47:05 -0500 Subject: storage/filesystem: dotgit, sanity check provided reference path On some operating systems, read() of a directory fd may actually succeed and return garbage resembling on-disk contents. As a result, dotgit may return successful from readReferenceFile() when it should in-fact not. This fixes readReferenceFile() on FreeBSD. Signed-off-by: Kyle Evans --- storage/filesystem/dotgit/dotgit_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'storage/filesystem/dotgit/dotgit_test.go') diff --git a/storage/filesystem/dotgit/dotgit_test.go b/storage/filesystem/dotgit/dotgit_test.go index 403f5ff..519f601 100644 --- a/storage/filesystem/dotgit/dotgit_test.go +++ b/storage/filesystem/dotgit/dotgit_test.go @@ -118,7 +118,7 @@ func testSetRefs(c *C, dir *DotGit) { c.Assert(err, IsNil) _, err = dir.readReferenceFile(".", "refs/heads/feature") - c.Assert(err, NotNil) + c.Assert(err, Equals, ErrIsDir) ref, err = dir.Ref("refs/heads/foo") c.Assert(err, IsNil) -- cgit