1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

#477 Remove NeedMerge boolean

Instead of storing the status in a new variable, derive it from
the existing three fields
This commit is contained in:
Giorgio Previtera
2019-07-14 09:50:20 +01:00
committed by Jesse Duffield
parent 504d506575
commit e83ef9858b
3 changed files with 64 additions and 17 deletions

View File

@ -188,7 +188,6 @@ func (c *GitCommand) GetStatusFiles() []*File {
Deleted: unstagedChange == "D" || stagedChange == "D",
HasMergeConflicts: hasMergeConflicts,
HasInlineMergeConflicts: hasInlineMergeConflicts,
NeedReset: !hasNoStagedChanges || hasMergeConflicts || hasInlineMergeConflicts,
Type: c.OSCommand.FileType(filename),
ShortStatus: change,
}
@ -474,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.NeedReset {
if file.HasStagedChanges || file.HasMergeConflicts || file.HasInlineMergeConflicts {
if err := c.OSCommand.RunCommand(fmt.Sprintf("git reset -- %s", quotedFileName)); err != nil {
return err
}