Skip to content

Commit

Permalink
refactoring log command (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 18, 2023
1 parent 857a1e7 commit 059c37f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var (

type WalkFunc func(commit *object.Commit) error

func walkHistory(hash sha.SHA1, walkFunc WalkFunc) error {
func walkHistory(rootGoitPath string, hash sha.SHA1, walkFunc WalkFunc) error {
queue := []sha.SHA1{hash}
visitMap := map[string]struct{}{}

Expand All @@ -37,7 +37,7 @@ func walkHistory(hash sha.SHA1, walkFunc WalkFunc) error {
}
visitMap[currentHash.String()] = struct{}{}

commitObject, err := object.GetObject(client.RootGoitPath, currentHash)
commitObject, err := object.GetObject(rootGoitPath, currentHash)
if err != nil {
return err
}
Expand Down Expand Up @@ -80,7 +80,7 @@ var logCmd = &cobra.Command{
}

// print log
if err := walkHistory(client.Head.Commit.Hash, func(commit *object.Commit) error {
if err := walkHistory(client.RootGoitPath, client.Head.Commit.Hash, func(commit *object.Commit) error {
fmt.Println(commit)
return nil
}); err != nil {
Expand Down

0 comments on commit 059c37f

Please sign in to comment.