diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-11-27 14:57:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-27 14:57:58 +0100 |
commit | 4e51e9e877e4e70c320bdda7e44d61618c6ae900 (patch) | |
tree | 791b48688be56d5936f9384559b234dfddf9a885 | |
parent | 60c567f0a3c22ac53f219fcc6482ee0e2ff425e6 (diff) | |
parent | c606e9fd6c4a8b9a49d3d276d1547f985accc92f (diff) | |
download | go-git-4e51e9e877e4e70c320bdda7e44d61618c6ae900.tar.gz |
Merge pull request #661 from ferhatelmas/ineffassign
all: fixes for ineffective assign
-rw-r--r-- | internal/revision/parser.go | 2 | ||||
-rw-r--r-- | plumbing/object/commit_test.go | 1 | ||||
-rw-r--r-- | remote.go | 3 | ||||
-rw-r--r-- | remote_test.go | 3 | ||||
-rw-r--r-- | repository_test.go | 2 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit_test.go | 1 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/writers_test.go | 1 | ||||
-rw-r--r-- | worktree_test.go | 12 |
8 files changed, 23 insertions, 2 deletions
diff --git a/internal/revision/parser.go b/internal/revision/parser.go index b45a6d8..d2c509e 100644 --- a/internal/revision/parser.go +++ b/internal/revision/parser.go @@ -254,7 +254,7 @@ func (p *Parser) parseAt() (Revisioner, error) { var lit, nextLit string var err error - tok, lit, err = p.scan() + tok, _, err = p.scan() if err != nil { return nil, err diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go index 2f5e075..191b14d 100644 --- a/plumbing/object/commit_test.go +++ b/plumbing/object/commit_test.go @@ -194,6 +194,7 @@ func (s *SuiteCommit) TestStringMultiLine(c *C) { f := fixtures.ByURL("https://github.com/src-d/go-git.git").One() sto, err := filesystem.NewStorage(f.DotGit()) + c.Assert(err, IsNil) o, err := sto.EncodedObject(plumbing.CommitObject, hash) c.Assert(err, IsNil) @@ -705,7 +705,7 @@ func isFastForward(s storer.EncodedObjectStorer, old, new plumbing.Hash) (bool, found := false iter := object.NewCommitPreorderIter(c, nil, nil) - return found, iter.ForEach(func(c *object.Commit) error { + err = iter.ForEach(func(c *object.Commit) error { if c.Hash != old { return nil } @@ -713,6 +713,7 @@ func isFastForward(s storer.EncodedObjectStorer, old, new plumbing.Hash) (bool, found = true return storer.ErrStop }) + return found, err } func (r *Remote) newUploadPackRequest(o *FetchOptions, diff --git a/remote_test.go b/remote_test.go index 3af7d39..3452ddf 100644 --- a/remote_test.go +++ b/remote_test.go @@ -176,6 +176,7 @@ func (s *RemoteSuite) testFetch(c *C, r *Remote, o *FetchOptions, expected []*pl var refs int l, err := r.s.IterReferences() + c.Assert(err, IsNil) l.ForEach(func(r *plumbing.Reference) error { refs++; return nil }) c.Assert(refs, Equals, len(expected)) @@ -512,6 +513,7 @@ func (s *RemoteSuite) TestPushNewReference(c *C) { server, err := PlainClone(url, true, &CloneOptions{ URL: fs.Root(), }) + c.Assert(err, IsNil) r, err := PlainClone(c.MkDir(), true, &CloneOptions{ URL: url, @@ -544,6 +546,7 @@ func (s *RemoteSuite) TestPushNewReferenceAndDeleteInBatch(c *C) { server, err := PlainClone(url, true, &CloneOptions{ URL: fs.Root(), }) + c.Assert(err, IsNil) r, err := PlainClone(c.MkDir(), true, &CloneOptions{ URL: url, diff --git a/repository_test.go b/repository_test.go index a4664ed..9d82651 100644 --- a/repository_test.go +++ b/repository_test.go @@ -82,6 +82,7 @@ func (s *RepositorySuite) TestInitStandardDotGit(c *C) { c.Assert(r, NotNil) l, err := fs.ReadDir(".git") + c.Assert(err, IsNil) c.Assert(len(l) > 0, Equals, true) cfg, err := r.Config() @@ -439,6 +440,7 @@ func (s *RepositorySuite) TestPlainCloneWithRecurseSubmodules(c *C) { c.Assert(err, IsNil) cfg, err := r.Config() + c.Assert(err, IsNil) c.Assert(cfg.Remotes, HasLen, 1) c.Assert(cfg.Submodules, HasLen, 2) } diff --git a/storage/filesystem/internal/dotgit/dotgit_test.go b/storage/filesystem/internal/dotgit/dotgit_test.go index d73df19..7d327c8 100644 --- a/storage/filesystem/internal/dotgit/dotgit_test.go +++ b/storage/filesystem/internal/dotgit/dotgit_test.go @@ -418,6 +418,7 @@ func (s *SuiteDotGit) TestNewObject(c *C) { c.Assert(err, IsNil) err = w.WriteHeader(plumbing.BlobObject, 14) + c.Assert(err, IsNil) n, err := w.Write([]byte("this is a test")) c.Assert(err, IsNil) c.Assert(n, Equals, 14) diff --git a/storage/filesystem/internal/dotgit/writers_test.go b/storage/filesystem/internal/dotgit/writers_test.go index 29c4d45..bf00762 100644 --- a/storage/filesystem/internal/dotgit/writers_test.go +++ b/storage/filesystem/internal/dotgit/writers_test.go @@ -85,6 +85,7 @@ func (s *SuiteDotGit) TestNewObjectPackUnused(c *C) { // check clean up of temporary files info, err = fs.ReadDir("") + c.Assert(err, IsNil) for _, fi := range info { c.Assert(fi.IsDir(), Equals, true) } diff --git a/worktree_test.go b/worktree_test.go index 9865613..1bdf946 100644 --- a/worktree_test.go +++ b/worktree_test.go @@ -60,10 +60,12 @@ func (s *WorktreeSuite) TestPullFastForward(c *C) { server, err := PlainClone(url, false, &CloneOptions{ URL: path, }) + c.Assert(err, IsNil) r, err := PlainClone(c.MkDir(), false, &CloneOptions{ URL: url, }) + c.Assert(err, IsNil) w, err := server.Worktree() c.Assert(err, IsNil) @@ -90,10 +92,12 @@ func (s *WorktreeSuite) TestPullNonFastForward(c *C) { server, err := PlainClone(url, false, &CloneOptions{ URL: path, }) + c.Assert(err, IsNil) r, err := PlainClone(c.MkDir(), false, &CloneOptions{ URL: url, }) + c.Assert(err, IsNil) w, err := server.Worktree() c.Assert(err, IsNil) @@ -212,6 +216,7 @@ func (s *WorktreeSuite) TestPullProgressWithRecursion(c *C) { c.Assert(err, IsNil) cfg, err := r.Config() + c.Assert(err, IsNil) c.Assert(cfg.Submodules, HasLen, 2) } @@ -306,6 +311,7 @@ func (s *WorktreeSuite) TestCheckoutSymlink(c *C) { } dir, err := ioutil.TempDir("", "checkout") + c.Assert(err, IsNil) defer os.RemoveAll(dir) r, err := PlainInit(dir, false) @@ -344,6 +350,7 @@ func (s *WorktreeSuite) TestFilenameNormalization(c *C) { server, err := PlainClone(url, false, &CloneOptions{ URL: path, }) + c.Assert(err, IsNil) filename := "페" @@ -358,6 +365,7 @@ func (s *WorktreeSuite) TestFilenameNormalization(c *C) { r, err := Clone(memory.NewStorage(), memfs.New(), &CloneOptions{ URL: url, }) + c.Assert(err, IsNil) w, err = r.Worktree() c.Assert(err, IsNil) @@ -444,6 +452,7 @@ func (s *WorktreeSuite) TestCheckoutIndexMem(c *C) { func (s *WorktreeSuite) TestCheckoutIndexOS(c *C) { dir, err := ioutil.TempDir("", "checkout") + c.Assert(err, IsNil) defer os.RemoveAll(dir) fs := osfs.New(filepath.Join(dir, "worktree")) @@ -864,6 +873,7 @@ func (s *WorktreeSuite) TestStatusAfterCheckout(c *C) { func (s *WorktreeSuite) TestStatusModified(c *C) { dir, err := ioutil.TempDir("", "status") + c.Assert(err, IsNil) defer os.RemoveAll(dir) fs := osfs.New(filepath.Join(dir, "worktree")) @@ -957,6 +967,7 @@ func (s *WorktreeSuite) TestStatusUntracked(c *C) { func (s *WorktreeSuite) TestStatusDeleted(c *C) { dir, err := ioutil.TempDir("", "status") + c.Assert(err, IsNil) defer os.RemoveAll(dir) fs := osfs.New(filepath.Join(dir, "worktree")) @@ -1105,6 +1116,7 @@ func (s *WorktreeSuite) TestAddUnmodified(c *C) { func (s *WorktreeSuite) TestAddSymlink(c *C) { dir, err := ioutil.TempDir("", "checkout") + c.Assert(err, IsNil) defer os.RemoveAll(dir) r, err := PlainInit(dir, false) |