summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-03-27 16:06:31 +0100
committerRémy Coutable <remy@rymai.me>2019-01-14 18:11:05 +0100
commit83106427c84b84f45a540c6defc89764d97e1716 (patch)
treea8afb00b46050edfcab4a111abc654feb08e5a90
parent8285205815ccdb25238fcae1c1e91063a46f19b0 (diff)
downloadgitlab-ce-83106427c84b84f45a540c6defc89764d97e1716.tar.gz
Opens specified text editor when creating a new changelog entry
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rwxr-xr-xbin/changelog10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/changelog b/bin/changelog
index 758c036161e..328d9495b96 100755
--- a/bin/changelog
+++ b/bin/changelog
@@ -148,7 +148,7 @@ class ChangelogEntry
def execute
assert_feature_branch!
- assert_title!
+ assert_title! unless editor
assert_new_file!
# Read type from $stdin unless is already set
@@ -162,6 +162,10 @@ class ChangelogEntry
write
amend_commit if options.amend
end
+
+ if editor
+ system("#{editor} '#{file_path}'")
+ end
end
private
@@ -180,6 +184,10 @@ class ChangelogEntry
File.write(file_path, contents)
end
+ def editor
+ ENV['EDITOR']
+ end
+
def amend_commit
fail_with "git add failed" unless system(*%W[git add #{file_path}])