diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-10 15:24:20 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-10 16:18:25 +1100 |
commit | cd17b46b55e312b3ba4e3ab9d3d96a8eeb20fded (patch) | |
tree | e35db3d358e3937f5ac960802775ccbdb29581a6 /pkg/commands | |
parent | d0d92c7697c311071e2fc4b5cc9fa9278a9c300a (diff) |
reset patch builder when we've escaped from the building phase and nothing has been added
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/patch_manager.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/commands/patch_manager.go b/pkg/commands/patch_manager.go index 671b90f45..3cd106fbc 100644 --- a/pkg/commands/patch_manager.go +++ b/pkg/commands/patch_manager.go @@ -214,6 +214,16 @@ func (p *PatchManager) Reset() { p.fileInfoMap = map[string]*fileInfo{} } +func (p *PatchManager) CommitSelected() bool { + return p.CommitSha != "" +} + func (p *PatchManager) IsEmpty() bool { - return p != nil && (p.CommitSha == "" || len(p.fileInfoMap) == 0) + for _, fileInfo := range p.fileInfoMap { + if fileInfo.mode == WHOLE || (fileInfo.mode == PART && len(fileInfo.includedLineIndices) > 0) { + return false + } + } + + return true } |