summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-07-10 16:07:59 -0700
committerStan Hu <stanhu@gmail.com>2018-07-11 10:15:22 -0700
commitdf54458a93fb1ec8d3564aa4e17857b6fa78fe7e (patch)
treed5877235db406ed589f8d8861f2f64afb7aec7f0 /bin
parentc6b670216c6e011e0007a934decdc003a318405b (diff)
downloadgitlab-ce-df54458a93fb1ec8d3564aa4e17857b6fa78fe7e.tar.gz
Truncate filenames created by bin/changelog to 140 characters
Diffstat (limited to 'bin')
-rwxr-xr-xbin/changelog14
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/changelog b/bin/changelog
index d7b2a1a2de9..758c036161e 100755
--- a/bin/changelog
+++ b/bin/changelog
@@ -23,6 +23,8 @@ module ChangelogHelpers
Abort = Class.new(StandardError)
Done = Class.new(StandardError)
+ MAX_FILENAME_LENGTH = 140 # ecryptfs has a limit of 140 characters
+
def capture_stdout(cmd)
output = IO.popen(cmd, &:read)
fail_with "command failed: #{cmd.join(' ')}" unless $?.success?
@@ -142,7 +144,9 @@ class ChangelogEntry
def initialize(options)
@options = options
+ end
+ def execute
assert_feature_branch!
assert_title!
assert_new_file!
@@ -221,10 +225,12 @@ class ChangelogEntry
end
def file_path
- File.join(
+ base_path = File.join(
unreleased_path,
- branch_name.gsub(/[^\w-]/, '-') << '.yml'
- )
+ branch_name.gsub(/[^\w-]/, '-'))
+
+ # Add padding for .yml extension
+ base_path[0..MAX_FILENAME_LENGTH - 5] + '.yml'
end
def unreleased_path
@@ -250,7 +256,7 @@ end
if $0 == __FILE__
begin
options = ChangelogOptionParser.parse(ARGV)
- ChangelogEntry.new(options)
+ ChangelogEntry.new(options).execute
rescue ChangelogHelpers::Abort => ex
$stderr.puts ex.message
exit 1