Skip to content

Commit

Permalink
all: fixes for ineffective assign
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed Nov 26, 2017
1 parent 60c567f commit c606e9f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/revision/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions plumbing/object/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,14 +705,15 @@ 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
}

found = true
return storer.ErrStop
})
return found, err
}

func (r *Remote) newUploadPackRequest(o *FetchOptions,
Expand Down
3 changes: 3 additions & 0 deletions remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions storage/filesystem/internal/dotgit/dotgit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions storage/filesystem/internal/dotgit/writers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
12 changes: 12 additions & 0 deletions worktree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -344,6 +350,7 @@ func (s *WorktreeSuite) TestFilenameNormalization(c *C) {
server, err := PlainClone(url, false, &CloneOptions{
URL: path,
})
c.Assert(err, IsNil)

filename := "페"

Expand All @@ -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)
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c606e9f

Please sign in to comment.