Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

vet:
go vet
go vet -tags test_sha256

test:
go test -v -cover -race
go test -tags test_sha256 -v -cover -race

bench:
go test -v -cover -test.bench=. -test.benchmem

coverage:
go test -coverprofile=c.out && go tool cover -html=c.out && rm c.out
go test -tags test_sha256 -coverprofile=c.out && go tool cover -html=c.out && rm c.out
2 changes: 1 addition & 1 deletion blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This demo also includes an image with changes on a branch for examination of ima
TreeEntry: &TreeEntry{
mode: EntryBlob,
typ: ObjectBlob,
id: MustIDFromString("adfd6da3c0a3fb038393144becbf37f14f780087"), // Blob ID of "README.txt" file
id: testrepoMarks[39], // Blob ID of "README.txt" file
parent: &Tree{
repo: testrepo,
},
Expand Down
10 changes: 5 additions & 5 deletions commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (

// Commit contains information of a Git commit.
type Commit struct {
// The SHA-1 hash of the commit.
ID *SHA1
// The hash of the commit.
ID Oid
// The author of the commit.
Author *Signature
// The committer of the commit.
Committer *Signature
// The full commit message.
Message string

parents []*SHA1
parents []Oid
*Tree

submodules Submodules
Expand All @@ -39,9 +39,9 @@ func (c *Commit) ParentsCount() int {
return len(c.parents)
}

// ParentID returns the SHA-1 hash of the n-th parent (0-based) of this commit.
// ParentID returns the Oid of the n-th parent (0-based) of this commit.
// It returns an ErrParentNotExist if no such parent exists.
func (c *Commit) ParentID(n int) (*SHA1, error) {
func (c *Commit) ParentID(n int) (Oid, error) {
if n >= len(c.parents) {
return nil, ErrParentNotExist
}
Expand Down
2 changes: 1 addition & 1 deletion commit_archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestCommit_Archive(t *testing.T) {
ArchiveTarGz,
} {
t.Run(string(format), func(t *testing.T) {
c, err := testrepo.CatFileCommit(ctx, "755fd577edcfd9209d0ac072eed3b022cbe4d39b")
c, err := testrepo.CatFileCommit(ctx, testrepoMarks[1].String())
if err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions commit_submodule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func TestCommit_Submodule(t *testing.T) {
ctx := context.Background()

c, err := testrepo.CatFileCommit(ctx, "4e59b72440188e7c2578299fc28ea425fbe9aece")
c, err := testrepo.CatFileCommit(ctx, testrepoMarks[29].String())
if err != nil {
t.Fatal(err)
}
Expand All @@ -21,7 +21,7 @@ func TestCommit_Submodule(t *testing.T) {
}
assert.Equal(t, "gogs/docs-api", mod.Name)
assert.Equal(t, "https://github.com/gogs/docs-api.git", mod.URL)
assert.Equal(t, "6b08f76a5313fa3d26859515b30aa17a5faa2807", mod.Commit)
assert.Equal(t, submoduleSHA.String(), mod.Commit)

_, err = c.Submodule(ctx, "404")
assert.Equal(t, ErrSubmoduleNotExist, err)
Expand Down
Loading