From a2b39f540e5b07cf361b530e19de30707b8ca0d7 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 10 Dec 2018 14:46:45 +0100 Subject: storage: new storage.ErrReferenceHasChanged error and test for CheckAndSetReference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Máximo Cuadros --- storage/filesystem/dotgit/dotgit.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'storage/filesystem/dotgit/dotgit.go') diff --git a/storage/filesystem/dotgit/dotgit.go b/storage/filesystem/dotgit/dotgit.go index a58c248..ba9667e 100644 --- a/storage/filesystem/dotgit/dotgit.go +++ b/storage/filesystem/dotgit/dotgit.go @@ -14,6 +14,7 @@ import ( "gopkg.in/src-d/go-billy.v4/osfs" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/storage" "gopkg.in/src-d/go-git.v4/utils/ioutil" "gopkg.in/src-d/go-billy.v4" @@ -596,7 +597,7 @@ func (d *DotGit) checkReferenceAndTruncate(f billy.File, old *plumbing.Reference return err } if ref.Hash() != old.Hash() { - return fmt.Errorf("reference has changed concurrently") + return storage.ErrReferenceHasChanged } _, err = f.Seek(0, io.SeekStart) if err != nil { -- cgit