aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-26 16:27:26 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-26 16:28:44 +0200
commitac29b8253e85302d57c7fad0fe23388ce92f26a4 (patch)
treeebd74d8bc4e6afae56721b48e77bec626ba5297b
parentf969370901f9f6d3c71c0391c74ac933d683e784 (diff)
downloadgit-bug-ac29b8253e85302d57c7fad0fe23388ce92f26a4.tar.gz
termui: detect when the title is not changed and abort the operation
-rw-r--r--termui/termui.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/termui/termui.go b/termui/termui.go
index 80c23844..f2163d96 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -243,7 +243,9 @@ func setTitleWithEditor(bug *cache.BugCache) error {
ui.g.Close()
ui.g = nil
- title, err := input.BugTitleEditorInput(ui.cache, bug.Snapshot().Title)
+ snap := bug.Snapshot()
+
+ title, err := input.BugTitleEditorInput(ui.cache, snap.Title)
if err != nil && err != input.ErrEmptyTitle {
return err
@@ -251,6 +253,8 @@ func setTitleWithEditor(bug *cache.BugCache) error {
if err == input.ErrEmptyTitle {
ui.msgPopup.Activate(msgPopupErrorTitle, "Empty title, aborting.")
+ } else if title == snap.Title {
+ ui.msgPopup.Activate(msgPopupErrorTitle, "No change, aborting.")
} else {
err := bug.SetTitle(title)
if err != nil {