From 827837b0b940d9367cefd03eb0e779711f9489da Mon Sep 17 00:00:00 2001 From: Giorgio Previtera Date: Sun, 14 Jul 2019 11:29:36 +0100 Subject: [PATCH] 477 Remove unnecessary variable check hasInlineMergeConflicts is always true with hasMergeConflicts is true --- pkg/commands/git.go | 2 +- pkg/commands/git_test.go | 27 --------------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/pkg/commands/git.go b/pkg/commands/git.go index 5aeaa08ee..5e2e7e33c 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -473,7 +473,7 @@ func (c *GitCommand) RebaseMode() (string, error) { func (c *GitCommand) DiscardAllFileChanges(file *File) error { // if the file isn't tracked, we assume you want to delete it quotedFileName := c.OSCommand.Quote(file.Name) - if file.HasStagedChanges || file.HasMergeConflicts || file.HasInlineMergeConflicts { + if file.HasStagedChanges || file.HasMergeConflicts { if err := c.OSCommand.RunCommand(fmt.Sprintf("git reset -- %s", quotedFileName)); err != nil { return err } diff --git a/pkg/commands/git_test.go b/pkg/commands/git_test.go index 5a043c4c7..51188f14d 100644 --- a/pkg/commands/git_test.go +++ b/pkg/commands/git_test.go @@ -1347,33 +1347,6 @@ func TestGitCommandDiscardAllFileChanges(t *testing.T) { return nil }, }, - { - "Reset and checkout inline merge conflicts", - func() (func(string, ...string) *exec.Cmd, *[][]string) { - cmdsCalled := [][]string{} - return func(cmd string, args ...string) *exec.Cmd { - cmdsCalled = append(cmdsCalled, args) - - return exec.Command("echo") - }, &cmdsCalled - }, - func(cmdsCalled *[][]string, err error) { - assert.NoError(t, err) - assert.Len(t, *cmdsCalled, 2) - assert.EqualValues(t, *cmdsCalled, [][]string{ - {"reset", "--", "test"}, - {"checkout", "--", "test"}, - }) - }, - &File{ - Name: "test", - Tracked: true, - HasInlineMergeConflicts: true, - }, - func(string) error { - return nil - }, - }, { "Reset and remove", func() (func(string, ...string) *exec.Cmd, *[][]string) {