mirror of
https://github.com/go-gitea/gitea.git
synced 2025-09-10 01:41:05 +00:00
Implement git refs API for listing references (branches, tags and other) (#5354)
* Inital routes to git refs api * Git refs API implementation * Update swagger * Fix copyright * Make swagger happy add basic test * Fix test * Fix test again :)
This commit is contained in:
committed by
techknowlogick
parent
294904321c
commit
08bf443016
37
vendor/gopkg.in/src-d/go-git.v4/plumbing/object/difftree.go
generated
vendored
Normal file
37
vendor/gopkg.in/src-d/go-git.v4/plumbing/object/difftree.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
|
||||
"gopkg.in/src-d/go-git.v4/utils/merkletrie"
|
||||
"gopkg.in/src-d/go-git.v4/utils/merkletrie/noder"
|
||||
)
|
||||
|
||||
// DiffTree compares the content and mode of the blobs found via two
|
||||
// tree objects.
|
||||
func DiffTree(a, b *Tree) (Changes, error) {
|
||||
return DiffTreeContext(context.Background(), a, b)
|
||||
}
|
||||
|
||||
// DiffTree compares the content and mode of the blobs found via two
|
||||
// tree objects. Provided context must be non-nil.
|
||||
// An error will be return if context expires
|
||||
func DiffTreeContext(ctx context.Context, a, b *Tree) (Changes, error) {
|
||||
from := NewTreeRootNode(a)
|
||||
to := NewTreeRootNode(b)
|
||||
|
||||
hashEqual := func(a, b noder.Hasher) bool {
|
||||
return bytes.Equal(a.Hash(), b.Hash())
|
||||
}
|
||||
|
||||
merkletrieChanges, err := merkletrie.DiffTreeContext(ctx, from, to, hashEqual)
|
||||
if err != nil {
|
||||
if err == merkletrie.ErrCanceled {
|
||||
return nil, ErrCanceled
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return newChanges(merkletrieChanges)
|
||||
}
|
Reference in New Issue
Block a user