Skip to content

Commit

Permalink
ignore some errors that breaks the mainloop unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
isacikgoz committed Jun 21, 2019
1 parent a93f0c3 commit 1a98e23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions cli/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ func (s *status) hunkStageEntry(item interface{}) error {
}

func (s *status) commit(item interface{}) error {
return s.bareCommit("--edit")
s.bareCommit("--edit") // why ignore err? simply to return status screen
return nil
}

func (s *status) amend(item interface{}) error {
return s.bareCommit("--amend")
s.bareCommit("--amend")
return nil
}

func (s *status) bareCommit(arg string) error {
Expand Down Expand Up @@ -192,6 +194,9 @@ func (s *status) resetAllEntries(item interface{}) error {

func (s *status) checkoutEntry(item interface{}) error {
entry := item.(*git.StatusEntry)
if entry.EntryType == git.StatusEntryTypeUntracked {
return nil // you can't checkout untracked items
}
args := []string{"checkout", "--", entry.String()}
return s.runCommandWithArgs(args)
}
Expand Down
2 changes: 1 addition & 1 deletion prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ mainloop:
case term.Enter, term.NewLine:
items, idx := p.list.Items()
if idx == NotFound {
continue
break
}
if err = p.selectionHandler(items[idx]); err != nil {
break mainloop
Expand Down

0 comments on commit 1a98e23

Please sign in to comment.