diff options
author | Daniel Martí <mvdan@mvdan.cc> | 2018-03-01 17:03:32 +0000 |
---|---|---|
committer | Daniel Martí <mvdan@mvdan.cc> | 2018-03-01 17:12:58 +0000 |
commit | ede92fa7ff9a6c5a61245e2ebeaa4d3929a37ce8 (patch) | |
tree | e99cf26f0a460240477bb52bdae1b5ea0832c3c8 | |
parent | 65886144d1e19b563c4e8854ba1cd0d532fea532 (diff) | |
download | go-git-ede92fa7ff9a6c5a61245e2ebeaa4d3929a37ce8.tar.gz |
all: remove some unused code
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
-rw-r--r-- | plumbing/cache/queue.go | 46 | ||||
-rw-r--r-- | plumbing/storer/object.go | 2 | ||||
-rw-r--r-- | plumbing/transport/server/server.go | 11 | ||||
-rw-r--r-- | storage/filesystem/internal/dotgit/dotgit.go | 2 | ||||
-rw-r--r-- | worktree.go | 4 |
5 files changed, 0 insertions, 65 deletions
diff --git a/plumbing/cache/queue.go b/plumbing/cache/queue.go deleted file mode 100644 index 85413e0..0000000 --- a/plumbing/cache/queue.go +++ /dev/null @@ -1,46 +0,0 @@ -package cache - -import "gopkg.in/src-d/go-git.v4/plumbing" - -// queue is a basic FIFO queue based on a circular list that resize as needed. -type queue struct { - elements []plumbing.Hash - size int - head int - tail int - count int -} - -// newQueue returns a queue with the specified initial size -func newQueue(size int) *queue { - return &queue{ - elements: make([]plumbing.Hash, size), - size: size, - } -} - -// Push adds a node to the queue. -func (q *queue) Push(h plumbing.Hash) { - if q.head == q.tail && q.count > 0 { - elements := make([]plumbing.Hash, len(q.elements)+q.size) - copy(elements, q.elements[q.head:]) - copy(elements[len(q.elements)-q.head:], q.elements[:q.head]) - q.head = 0 - q.tail = len(q.elements) - q.elements = elements - } - q.elements[q.tail] = h - q.tail = (q.tail + 1) % len(q.elements) - q.count++ -} - -// Pop removes and returns a Hash from the queue in first to last order. -func (q *queue) Pop() plumbing.Hash { - if q.count == 0 { - return plumbing.ZeroHash - } - node := q.elements[q.head] - q.head = (q.head + 1) % len(q.elements) - q.count-- - return node -} diff --git a/plumbing/storer/object.go b/plumbing/storer/object.go index f1d19ef..92aa629 100644 --- a/plumbing/storer/object.go +++ b/plumbing/storer/object.go @@ -174,7 +174,6 @@ func (iter *EncodedObjectLookupIter) Close() { // no longer needed. type EncodedObjectSliceIter struct { series []plumbing.EncodedObject - pos int } // NewEncodedObjectSliceIter returns an object iterator for the given slice of @@ -218,7 +217,6 @@ func (iter *EncodedObjectSliceIter) Close() { // longer needed. type MultiEncodedObjectIter struct { iters []EncodedObjectIter - pos int } // NewMultiEncodedObjectIter returns an object iterator for the given slice of diff --git a/plumbing/transport/server/server.go b/plumbing/transport/server/server.go index 2357bd6..20bd12e 100644 --- a/plumbing/transport/server/server.go +++ b/plumbing/transport/server/server.go @@ -298,17 +298,6 @@ func (s *rpSession) updateReferences(req *packp.ReferenceUpdateRequest) { } } -func (s *rpSession) failAtomicUpdate() (*packp.ReportStatus, error) { - rs := s.reportStatus() - for _, cs := range rs.CommandStatuses { - if cs.Error() == nil { - cs.Status = "atomic updated" - } - } - - return rs, s.firstErr -} - func (s *rpSession) writePackfile(r io.ReadCloser) error { if r == nil { return nil diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go index fac7aec..027ef83 100644 --- a/storage/filesystem/internal/dotgit/dotgit.go +++ b/storage/filesystem/internal/dotgit/dotgit.go @@ -798,5 +798,3 @@ func isNum(b byte) bool { func isHexAlpha(b byte) bool { return b >= 'a' && b <= 'f' || b >= 'A' && b <= 'F' } - -type refCache map[plumbing.ReferenceName]*plumbing.Reference diff --git a/worktree.go b/worktree.go index a23397e..394dce4 100644 --- a/worktree.go +++ b/worktree.go @@ -607,10 +607,6 @@ func (w *Worktree) getTreeFromCommitHash(commit plumbing.Hash) (*object.Tree, er return c.Tree() } -func (w *Worktree) initializeIndex() error { - return w.r.Storer.SetIndex(&index.Index{Version: 2}) -} - var fillSystemInfo func(e *index.Entry, sys interface{}) const gitmodulesFile = ".gitmodules" |