Commit 906c24e4 authored by Robert Speicher's avatar Robert Speicher

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
parents 64fc7c1b 83106427
...@@ -148,7 +148,7 @@ class ChangelogEntry ...@@ -148,7 +148,7 @@ class ChangelogEntry
def execute def execute
assert_feature_branch! assert_feature_branch!
assert_title! assert_title! unless editor
assert_new_file! assert_new_file!
# Read type from $stdin unless is already set # Read type from $stdin unless is already set
...@@ -162,6 +162,10 @@ class ChangelogEntry ...@@ -162,6 +162,10 @@ class ChangelogEntry
write write
amend_commit if options.amend amend_commit if options.amend
end end
if editor
system("#{editor} '#{file_path}'")
end
end end
private private
...@@ -180,6 +184,10 @@ class ChangelogEntry ...@@ -180,6 +184,10 @@ class ChangelogEntry
File.write(file_path, contents) File.write(file_path, contents)
end end
def editor
ENV['EDITOR']
end
def amend_commit def amend_commit
fail_with "git add failed" unless system(*%W[git add #{file_path}]) fail_with "git add failed" unless system(*%W[git add #{file_path}])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment