Skip to content

Commit

Permalink
change scope: logRecord to LogRecord (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 17, 2023
1 parent e1b7e8f commit 4fd5347
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions internal/store/reflog.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import (
"github.com/fatih/color"
)

type logRecord struct {
hash sha.SHA1
type LogRecord struct {
Hash sha.SHA1
isHead bool
references []string
recType log.RecordType
message string
}

type Reflog struct {
records []*logRecord
records []*LogRecord
}

func NewReflog(rootGoitPath string, head *Head, refs *Refs) (*Reflog, error) {
Expand All @@ -35,7 +35,7 @@ func NewReflog(rootGoitPath string, head *Head, refs *Refs) (*Reflog, error) {

func newReflog() *Reflog {
return &Reflog{
records: make([]*logRecord, 0),
records: make([]*LogRecord, 0),
}
}

Expand All @@ -49,7 +49,7 @@ func (r *Reflog) load(rootGoitPath string, head *Head, refs *Refs) error {

scanner := bufio.NewScanner(f)
for scanner.Scan() {
record := &logRecord{
record := &LogRecord{
references: make([]string, 0),
}

Expand All @@ -61,13 +61,13 @@ func (r *Reflog) load(rootGoitPath string, head *Head, refs *Refs) error {
continue
}
if sp1[1] == strings.Repeat("0", 40) {
record.hash = nil
record.Hash = nil
} else {
hash, err := sha.ReadHash(sp1[1])
if err != nil {
return fmt.Errorf("fail to read hash %s: %w", sp1[1], err)
}
record.hash = hash
record.Hash = hash

// references
if head.Commit.Hash.Compare(hash) {
Expand Down
2 changes: 1 addition & 1 deletion internal/store/reflog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestReflogLoad(t *testing.T) {
},
fields: "",
want: &Reflog{
records: make([]*logRecord, 0),
records: make([]*LogRecord, 0),
},
wantErr: false,
}
Expand Down

0 comments on commit 4fd5347

Please sign in to comment.