summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-01-16 19:58:43 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-01-16 19:58:43 +0000
commit906c24e46399d5111201714c89156dbfd8826b10 (patch)
tree35520927c40d81ad236be55066e8e1ee6c8cfc09
parent64fc7c1bce3f9143391f1e4dd997660e58bc0780 (diff)
parent83106427c84b84f45a540c6defc89764d97e1716 (diff)
downloadgitlab-ce-906c24e46399d5111201714c89156dbfd8826b10.tar.gz
Merge branch '44488-open-editor-when-creating-a-new-changelog-entry' into 'master'
Resolve "Use $EDITOR or another Environment variable to open the new Changelog entry directly in your editor" Closes #44488 See merge request gitlab-org/gitlab-ce!18020
-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}])