Skip to content

Commit

Permalink
log for branch add (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
JunNishimura committed Jun 12, 2023
1 parent d1a0e3d commit b220a6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package cmd

import (
"fmt"
"time"

"github.com/JunNishimura/Goit/internal/log"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -48,6 +50,9 @@ var branchCmd = &cobra.Command{
if err := client.Refs.AddBranch(client.RootGoitPath, addBranchName, addBranchHash); err != nil {
return fmt.Errorf("fail to add branch '%s': %w", addBranchName, err)
}
if err := gLogger.WriteBranch(log.NewRecord(log.BranchRecord, nil, addBranchHash, client.Conf.GetUserName(), client.Conf.GetEmail(), time.Now(), fmt.Sprintf("Created from %s", client.Head.Reference)), addBranchName); err != nil {
return fmt.Errorf("log error: %w", err)
}
}

// list branches
Expand Down

0 comments on commit b220a6f

Please sign in to comment.