Skip to content

Commit

Permalink
add GetRecord method for reflog (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 17, 2023
1 parent 4fd5347 commit 53a61fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/store/reflog.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ func (r *Reflog) load(rootGoitPath string, head *Head, refs *Refs) error {
return nil
}

func (r *Reflog) GetRecord(num int) (*LogRecord, error) {
if num >= len(r.records) {
return nil, fmt.Errorf("num %d needs to be below %d", num, len(r.records)-1)
}
return r.records[len(r.records)-1-num], nil
}

func (r *Reflog) Show() {
for i := range r.records {
idx := len(r.records) - i - 1
Expand Down

0 comments on commit 53a61fd

Please sign in to comment.