Skip to content

Commit 06a6ad4

Browse files
committed
make-snapshot: Remove an unnecessary variable
This is a refactoring change, which should have no impact on behaviors. Now, if patchlevel is true, tag is empty. So `if patchlevel` always does nothing. Given that prerelease is false and tag is not nil, removing `if patchlevel` should have no impact.
1 parent 6601640 commit 06a6ad4

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

tool/make-snapshot

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ end
253253

254254
def package(vcs, rev, destdir, tmp = nil)
255255
pwd = Dir.pwd
256-
patchlevel = false
257256
prerelease = false
258257
if rev and revision = rev[/@(\h+)\z/, 1]
259258
rev = $`
@@ -275,7 +274,6 @@ def package(vcs, rev, destdir, tmp = nil)
275274
tag = "#{$4}#{$5}"
276275
url = vcs.tag("v#{$1}_#{$2}_#{$3}_#{$4}#{$5}")
277276
when /\A(\d+)\.(\d+)\.(\d+)\z/
278-
patchlevel = true
279277
tag = ""
280278
url = vcs.tag("v#{$1}_#{$2}_#{$3}")
281279
when /\A(\d+)\.(\d+)\z/
@@ -351,13 +349,7 @@ def package(vcs, rev, destdir, tmp = nil)
351349
[api_major_version, api_minor_version, version_teeny].join('.')
352350
end
353351
version or return
354-
if patchlevel
355-
unless tag.empty?
356-
versionhdr ||= File.read("#{v}/version.h")
357-
patchlevel = versionhdr[/^\#define\s+RUBY_PATCHLEVEL\s+(\d+)/, 1]
358-
tag = (patchlevel ? "p#{patchlevel}" : vcs.revision_name(revision))
359-
end
360-
elsif prerelease
352+
if prerelease
361353
versionhdr ||= File.read("#{v}/version.h")
362354
versionhdr.sub!(/^\#\s*define\s+RUBY_PATCHLEVEL_STR\s+"\K.+?(?=")/, tag) or raise "no match of RUBY_PATCHLEVEL_STR to replace"
363355
File.write("#{v}/version.h", versionhdr)

0 commit comments

Comments
 (0)