mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-23 12:18:51 +02:00
477 Remove unnecessary variable check
hasInlineMergeConflicts is always true with hasMergeConflicts is true
This commit is contained in:
parent
e83ef9858b
commit
827837b0b9
@ -473,7 +473,7 @@ func (c *GitCommand) RebaseMode() (string, error) {
|
|||||||
func (c *GitCommand) DiscardAllFileChanges(file *File) error {
|
func (c *GitCommand) DiscardAllFileChanges(file *File) error {
|
||||||
// if the file isn't tracked, we assume you want to delete it
|
// if the file isn't tracked, we assume you want to delete it
|
||||||
quotedFileName := c.OSCommand.Quote(file.Name)
|
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 {
|
if err := c.OSCommand.RunCommand(fmt.Sprintf("git reset -- %s", quotedFileName)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1347,33 +1347,6 @@ func TestGitCommandDiscardAllFileChanges(t *testing.T) {
|
|||||||
return nil
|
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",
|
"Reset and remove",
|
||||||
func() (func(string, ...string) *exec.Cmd, *[][]string) {
|
func() (func(string, ...string) *exec.Cmd, *[][]string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user