Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit d8d17e7

Browse files
authored
Merge pull request #766 from mvdan/patches
Unused params, unused code, make Go tip's vet happy
2 parents 4397264 + e850aea commit d8d17e7

File tree

7 files changed

+14
-83
lines changed

7 files changed

+14
-83
lines changed

plumbing/cache/queue.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

plumbing/storer/object.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ func (iter *EncodedObjectLookupIter) Close() {
174174
// no longer needed.
175175
type EncodedObjectSliceIter struct {
176176
series []plumbing.EncodedObject
177-
pos int
178177
}
179178

180179
// NewEncodedObjectSliceIter returns an object iterator for the given slice of
@@ -218,7 +217,6 @@ func (iter *EncodedObjectSliceIter) Close() {
218217
// longer needed.
219218
type MultiEncodedObjectIter struct {
220219
iters []EncodedObjectIter
221-
pos int
222220
}
223221

224222
// NewMultiEncodedObjectIter returns an object iterator for the given slice of

plumbing/transport/server/server.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,6 @@ func (s *rpSession) updateReferences(req *packp.ReferenceUpdateRequest) {
298298
}
299299
}
300300

301-
func (s *rpSession) failAtomicUpdate() (*packp.ReportStatus, error) {
302-
rs := s.reportStatus()
303-
for _, cs := range rs.CommandStatuses {
304-
if cs.Error() == nil {
305-
cs.Status = "atomic updated"
306-
}
307-
}
308-
309-
return rs, s.firstErr
310-
}
311-
312301
func (s *rpSession) writePackfile(r io.ReadCloser) error {
313302
if r == nil {
314303
return nil

plumbing/transport/test/receive_pack.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (s *ReceivePackSuite) TestAdvertisedReferencesNotExists(c *C) {
5050
c.Assert(err, IsNil)
5151
req := packp.NewReferenceUpdateRequest()
5252
req.Commands = []*packp.Command{
53-
{"master", plumbing.ZeroHash, plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")},
53+
{Name: "master", Old: plumbing.ZeroHash, New: plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5")},
5454
}
5555

5656
writer, err := r.ReceivePack(context.Background(), req)
@@ -99,7 +99,7 @@ func (s *ReceivePackSuite) TestFullSendPackOnEmpty(c *C) {
9999
fixture := fixtures.Basic().ByTag("packfile").One()
100100
req := packp.NewReferenceUpdateRequest()
101101
req.Commands = []*packp.Command{
102-
{"refs/heads/master", plumbing.ZeroHash, fixture.Head},
102+
{Name: "refs/heads/master", Old: plumbing.ZeroHash, New: fixture.Head},
103103
}
104104
s.receivePack(c, endpoint, req, fixture, full)
105105
s.checkRemoteHead(c, endpoint, fixture.Head)
@@ -110,7 +110,7 @@ func (s *ReceivePackSuite) TestSendPackWithContext(c *C) {
110110
req := packp.NewReferenceUpdateRequest()
111111
req.Packfile = fixture.Packfile()
112112
req.Commands = []*packp.Command{
113-
{"refs/heads/master", plumbing.ZeroHash, fixture.Head},
113+
{Name: "refs/heads/master", Old: plumbing.ZeroHash, New: fixture.Head},
114114
}
115115

116116
r, err := s.Client.NewReceivePackSession(s.EmptyEndpoint, s.EmptyAuth)
@@ -135,7 +135,7 @@ func (s *ReceivePackSuite) TestSendPackOnEmpty(c *C) {
135135
fixture := fixtures.Basic().ByTag("packfile").One()
136136
req := packp.NewReferenceUpdateRequest()
137137
req.Commands = []*packp.Command{
138-
{"refs/heads/master", plumbing.ZeroHash, fixture.Head},
138+
{Name: "refs/heads/master", Old: plumbing.ZeroHash, New: fixture.Head},
139139
}
140140
s.receivePack(c, endpoint, req, fixture, full)
141141
s.checkRemoteHead(c, endpoint, fixture.Head)
@@ -147,7 +147,7 @@ func (s *ReceivePackSuite) TestSendPackOnEmptyWithReportStatus(c *C) {
147147
fixture := fixtures.Basic().ByTag("packfile").One()
148148
req := packp.NewReferenceUpdateRequest()
149149
req.Commands = []*packp.Command{
150-
{"refs/heads/master", plumbing.ZeroHash, fixture.Head},
150+
{Name: "refs/heads/master", Old: plumbing.ZeroHash, New: fixture.Head},
151151
}
152152
req.Capabilities.Set(capability.ReportStatus)
153153
s.receivePack(c, endpoint, req, fixture, full)
@@ -160,7 +160,7 @@ func (s *ReceivePackSuite) TestFullSendPackOnNonEmpty(c *C) {
160160
fixture := fixtures.Basic().ByTag("packfile").One()
161161
req := packp.NewReferenceUpdateRequest()
162162
req.Commands = []*packp.Command{
163-
{"refs/heads/master", fixture.Head, fixture.Head},
163+
{Name: "refs/heads/master", Old: fixture.Head, New: fixture.Head},
164164
}
165165
s.receivePack(c, endpoint, req, fixture, full)
166166
s.checkRemoteHead(c, endpoint, fixture.Head)
@@ -172,7 +172,7 @@ func (s *ReceivePackSuite) TestSendPackOnNonEmpty(c *C) {
172172
fixture := fixtures.Basic().ByTag("packfile").One()
173173
req := packp.NewReferenceUpdateRequest()
174174
req.Commands = []*packp.Command{
175-
{"refs/heads/master", fixture.Head, fixture.Head},
175+
{Name: "refs/heads/master", Old: fixture.Head, New: fixture.Head},
176176
}
177177
s.receivePack(c, endpoint, req, fixture, full)
178178
s.checkRemoteHead(c, endpoint, fixture.Head)
@@ -184,7 +184,7 @@ func (s *ReceivePackSuite) TestSendPackOnNonEmptyWithReportStatus(c *C) {
184184
fixture := fixtures.Basic().ByTag("packfile").One()
185185
req := packp.NewReferenceUpdateRequest()
186186
req.Commands = []*packp.Command{
187-
{"refs/heads/master", fixture.Head, fixture.Head},
187+
{Name: "refs/heads/master", Old: fixture.Head, New: fixture.Head},
188188
}
189189
req.Capabilities.Set(capability.ReportStatus)
190190

@@ -198,7 +198,7 @@ func (s *ReceivePackSuite) TestSendPackOnNonEmptyWithReportStatusWithError(c *C)
198198
fixture := fixtures.Basic().ByTag("packfile").One()
199199
req := packp.NewReferenceUpdateRequest()
200200
req.Commands = []*packp.Command{
201-
{"refs/heads/master", plumbing.ZeroHash, fixture.Head},
201+
{Name: "refs/heads/master", Old: plumbing.ZeroHash, New: fixture.Head},
202202
}
203203
req.Capabilities.Set(capability.ReportStatus)
204204

@@ -306,7 +306,7 @@ func (s *ReceivePackSuite) testSendPackAddReference(c *C) {
306306

307307
req := packp.NewReferenceUpdateRequest()
308308
req.Commands = []*packp.Command{
309-
{"refs/heads/newbranch", plumbing.ZeroHash, fixture.Head},
309+
{Name: "refs/heads/newbranch", Old: plumbing.ZeroHash, New: fixture.Head},
310310
}
311311
if ar.Capabilities.Supports(capability.ReportStatus) {
312312
req.Capabilities.Set(capability.ReportStatus)
@@ -329,7 +329,7 @@ func (s *ReceivePackSuite) testSendPackDeleteReference(c *C) {
329329

330330
req := packp.NewReferenceUpdateRequest()
331331
req.Commands = []*packp.Command{
332-
{"refs/heads/newbranch", fixture.Head, plumbing.ZeroHash},
332+
{Name: "refs/heads/newbranch", Old: fixture.Head, New: plumbing.ZeroHash},
333333
}
334334
if ar.Capabilities.Supports(capability.ReportStatus) {
335335
req.Capabilities.Set(capability.ReportStatus)

remote.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) error {
130130
return NoErrAlreadyUpToDate
131131
}
132132

133-
objects, err := objectsToPush(req.Commands)
134-
if err != nil {
135-
return err
136-
}
133+
objects := objectsToPush(req.Commands)
137134

138135
haves, err := referencesToHashes(remoteRefs)
139136
if err != nil {
@@ -907,7 +904,7 @@ func (r *Remote) List(o *ListOptions) ([]*plumbing.Reference, error) {
907904
return resultRefs, nil
908905
}
909906

910-
func objectsToPush(commands []*packp.Command) ([]plumbing.Hash, error) {
907+
func objectsToPush(commands []*packp.Command) []plumbing.Hash {
911908
var objects []plumbing.Hash
912909
for _, cmd := range commands {
913910
if cmd.New == plumbing.ZeroHash {
@@ -916,8 +913,7 @@ func objectsToPush(commands []*packp.Command) ([]plumbing.Hash, error) {
916913

917914
objects = append(objects, cmd.New)
918915
}
919-
920-
return objects, nil
916+
return objects
921917
}
922918

923919
func referencesToHashes(refs storer.ReferenceStorer) ([]plumbing.Hash, error) {

storage/filesystem/internal/dotgit/dotgit.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,5 +798,3 @@ func isNum(b byte) bool {
798798
func isHexAlpha(b byte) bool {
799799
return b >= 'a' && b <= 'f' || b >= 'A' && b <= 'F'
800800
}
801-
802-
type refCache map[plumbing.ReferenceName]*plumbing.Reference

worktree.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,6 @@ func (w *Worktree) getTreeFromCommitHash(commit plumbing.Hash) (*object.Tree, er
607607
return c.Tree()
608608
}
609609

610-
func (w *Worktree) initializeIndex() error {
611-
return w.r.Storer.SetIndex(&index.Index{Version: 2})
612-
}
613-
614610
var fillSystemInfo func(e *index.Entry, sys interface{})
615611

616612
const gitmodulesFile = ".gitmodules"

0 commit comments

Comments
 (0)