summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-12-20 10:58:16 +0000
committerRobert Speicher <robert@gitlab.com>2016-12-20 10:58:16 +0000
commit4e169327bf031603d31398940a86346d44e7521a (patch)
tree629807d41251c1b28ed7b192076eed2a64d8494f
parent7607226026443cb6e5b0263f8263f12a4b9987f5 (diff)
parent1c489296fd43fa45621b2ab6e6982327fb864b56 (diff)
downloadgitlab-ce-4e169327bf031603d31398940a86346d44e7521a.tar.gz
Merge branch 'nuke-ugly-spaces-in-changelog-generator' into 'master'
Remove trailing whitespace when generating changelog entry ## What does this MR do? It removes the trailing whitespace when a new changelog entry file is created by our changelog generator. ## Why was this MR needed? If you run `bin/changelog` without passing merge request and author, these two lines are empty, with a trailing space at the end. I have to remove this trailing space manually. See merge request !7948
-rwxr-xr-xbin/changelog11
-rw-r--r--changelogs/unreleased/nuke-ugly-spaces-in-changelog-generator.yml4
2 files changed, 12 insertions, 3 deletions
diff --git a/bin/changelog b/bin/changelog
index e07b1ad237a..4c894f8ff5b 100755
--- a/bin/changelog
+++ b/bin/changelog
@@ -84,12 +84,15 @@ class ChangelogEntry
end
end
+ private
+
def contents
- YAML.dump(
+ yaml_content = YAML.dump(
'title' => title,
'merge_request' => options.merge_request,
'author' => options.author
)
+ remove_trailing_whitespace(yaml_content)
end
def write
@@ -101,8 +104,6 @@ class ChangelogEntry
exec("git commit --amend")
end
- private
-
def fail_with(message)
$stderr.puts "\e[31merror\e[0m #{message}"
exit 1
@@ -160,6 +161,10 @@ class ChangelogEntry
def branch_name
@branch_name ||= %x{git symbolic-ref --short HEAD}.strip
end
+
+ def remove_trailing_whitespace(yaml_content)
+ yaml_content.gsub(/ +$/, '')
+ end
end
if $0 == __FILE__
diff --git a/changelogs/unreleased/nuke-ugly-spaces-in-changelog-generator.yml b/changelogs/unreleased/nuke-ugly-spaces-in-changelog-generator.yml
new file mode 100644
index 00000000000..fd173031107
--- /dev/null
+++ b/changelogs/unreleased/nuke-ugly-spaces-in-changelog-generator.yml
@@ -0,0 +1,4 @@
+---
+title: Remove trailing whitespace when generating changelog entry
+merge_request: 7948
+author: