Skip to content

Commit

Permalink
chore: resolve breaking changes from upgrade git to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
fallion committed Feb 27, 2020
1 parent 4fc1038 commit 2a3947d
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cmd/get_commits.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
history "github.com/outillage/git/pkg"
history "github.com/outillage/git/v2"
"gopkg.in/src-d/go-git.v4/plumbing"
)

Expand Down
10 changes: 5 additions & 5 deletions cmd/get_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package cmd
import (
"testing"

history "github.com/outillage/git/pkg"
history "github.com/outillage/git/v2"
"github.com/stretchr/testify/assert"
)

func TestGetCommitsDetachedTags(t *testing.T) {
repo, err := history.OpenGit("../testdata/detached_tag", false)
repo, err := history.OpenGit("../testdata/detached_tag", nil)

assert.NoError(t, err)

Expand All @@ -30,7 +30,7 @@ func TestGetCommitsDetachedTags(t *testing.T) {
}

func TestGetCommitsSingleBranch(t *testing.T) {
repo, err := history.OpenGit("../testdata/single_branch_tags", false)
repo, err := history.OpenGit("../testdata/single_branch_tags", nil)

assert.NoError(t, err)

Expand All @@ -52,7 +52,7 @@ func TestGetCommitsSingleBranch(t *testing.T) {
}

func TestGetCommitsReleaseCommit(t *testing.T) {
repo, err := history.OpenGit("../testdata/release_commit", false)
repo, err := history.OpenGit("../testdata/release_commit", nil)

assert.NoError(t, err)

Expand All @@ -76,7 +76,7 @@ func TestGetCommitsReleaseCommit(t *testing.T) {
}

func TestGetCommitsReleaseNonCompliantCommit(t *testing.T) {
repo, err := history.OpenGit("../testdata/release_noncompliant_commit", false)
repo, err := history.OpenGit("../testdata/release_noncompliant_commit", nil)

assert.NoError(t, err)

Expand Down
16 changes: 11 additions & 5 deletions cmd/log.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package cmd

import (
"io/ioutil"
"log"
"os"

history "github.com/outillage/git/pkg"
history "github.com/outillage/git/v2"
"github.com/outillage/quoad"
"github.com/outillage/release-notary/internal/text"
"github.com/spf13/cobra"
Expand All @@ -18,12 +20,16 @@ var logCmd = &cobra.Command{
Short: "Prints commits between two tags",
Long: "In default prints the commits between 2 tags. Can be overriden to specify exact commits.",
RunE: func(cmd *cobra.Command, args []string) error {
debug := false
if cmd.Flag("verbose").Value.String() == "true" {
debug = true
debugLogger := log.Logger{}
debugLogger.SetPrefix("[DEBUG] ")
debugLogger.SetOutput(os.Stdout)

if !Verbose {
debugLogger.SetOutput(ioutil.Discard)
debugLogger.SetPrefix("")
}

repo, err := history.OpenGit(".", debug)
repo, err := history.OpenGit(".", &debugLogger)

if err != nil {
return err
Expand Down
24 changes: 13 additions & 11 deletions cmd/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ package cmd
import (
"errors"
"fmt"
"io/ioutil"
"log"
"os"
"strings"

history "github.com/outillage/git/pkg"
history "github.com/outillage/git/v2"
"github.com/outillage/quoad"
"github.com/outillage/release-notary/internal/releaser"
"github.com/outillage/release-notary/internal/slack"
Expand All @@ -26,17 +29,16 @@ var publishCmd = &cobra.Command{
Short: "Publishes release notes",
Long: "",
RunE: func(cmd *cobra.Command, args []string) error {
debug := false
if cmd.Flag("verbose").Value.String() == "true" {
debug = true
}
debugLogger := log.Logger{}
debugLogger.SetPrefix("[DEBUG] ")
debugLogger.SetOutput(os.Stdout)

dryRun := false
if cmd.Flag("dry-run").Value.String() == "true" {
dryRun = true
if !Verbose {
debugLogger.SetOutput(ioutil.Discard)
debugLogger.SetPrefix("")
}

repo, err := history.OpenGit(".", debug)
repo, err := history.OpenGit(".", &debugLogger)

if err != nil {
return err
Expand Down Expand Up @@ -72,13 +74,13 @@ var publishCmd = &cobra.Command{
Complex: complexOutput,
}

content := releaseNotes.Generate(sections, dryRun)
content := releaseNotes.Generate(sections, DryRun)

if err != nil {
return err
}

if dryRun {
if DryRun {
fmt.Println("my job here is done...")
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.13

require (
github.com/json-iterator/go v1.1.9
github.com/outillage/git/v2/v2 v2.0.1
github.com/outillage/git/v2 v2.0.1
github.com/outillage/quoad v0.2.0
github.com/spf13/cobra v0.0.6
github.com/spf13/viper v1.6.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/outillage/git v1.2.6 h1:mWCPxhxkuSLKd4dvnV3GXsDU2Oon10BgD6qOM+ljkZA=
github.com/outillage/git v1.2.6/go.mod h1:5gcZpe6CD8GesH9UAeYYAEPn3987FeSSeZwkxFNeePA=
github.com/outillage/git/v2 v2.0.1 h1:spc5mZmSvB05Yjz119tpiDCFMQKlglEHDcSqzBA2Log=
github.com/outillage/git/v2 v2.0.1/go.mod h1:c6L0qnmoC0TYDt9Cer+HziO77yzvrfNlPAEXBAH+HRM=
github.com/outillage/quoad v0.2.0 h1:jAFYegH3ASd3YEQCVuviHMiWDFxQAOfl7ox4BSBPriY=
github.com/outillage/quoad v0.2.0/go.mod h1:VdBGieQx7EtZDWn10L2fyW6ZT3uDstIhlTbPwDNL25o=
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
Expand Down

0 comments on commit 2a3947d

Please sign in to comment.