mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
file2lastrev.rb: changed revision may be nil
[ci skip]
When `--suppress_not_found` option is given, no revision information is available. And remove extraneous newline, when result is empty or ends with a newline.
This commit is contained in:
parent
3475b66160
commit
8e2c70af14
1 changed files with 4 additions and 2 deletions
|
@ -69,7 +69,7 @@ formatter =
|
|||
case @format
|
||||
when :changed, nil
|
||||
Proc.new {|last, changed|
|
||||
changed
|
||||
changed || ""
|
||||
}
|
||||
when :revision_h
|
||||
Proc.new {|last, changed, modified, branch, title|
|
||||
|
@ -90,7 +90,9 @@ formatter =
|
|||
ok = true
|
||||
(ARGV.empty? ? [nil] : ARGV).each do |arg|
|
||||
begin
|
||||
@output.write(formatter[*vcs.get_revisions(arg)]+"\n", overwrite: true)
|
||||
data = formatter[*vcs.get_revisions(arg)]
|
||||
data.sub!(/(?<!\A|\n)\z/, "\n")
|
||||
@output.write(data, overwrite: true)
|
||||
rescue => e
|
||||
warn "#{File.basename(Program)}: #{e.message}"
|
||||
ok = false
|
||||
|
|
Loading…
Reference in a new issue