1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Merge branch 'stable'

Conflicts:
	doc-src/HAML_CHANGELOG.md
	doc-src/SASS_CHANGELOG.md
This commit is contained in:
Nathan Weizenbaum 2010-02-25 21:21:05 -08:00
commit f835aacfac
3 changed files with 41 additions and 14 deletions

View file

@ -195,6 +195,12 @@ that surrounds the filtered text with `<style>` and CDATA tags.
* The `puts` helper has been removed.
Use {Haml::Helpers#haml\_concat} instead.
## 2.2.21 (Unreleased)
* Fix a few bugs in the git-revision-reporting in {Haml::Version#version}.
In particular, it will still work if `git gc` has been called recently,
or if various files are missing.
## 2.2.20
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.20).

View file

@ -230,6 +230,12 @@ Several bug fixes and minor improvements have been made, including:
and `tealbang(12)` now renders as `tealbang(12)`
rather than `teal bang(12)`.
## 2.2.21 (Unreleased)
* Fix a few bugs in the git-revision-reporting in {Haml::Version#version}.
In particular, it will still work if `git gc` has been called recently,
or if various files are missing.
## 2.2.20
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.20).

View file

@ -38,27 +38,42 @@ module Haml
@@version[:number] = [:major, :minor, :teeny].map { |comp| @@version[comp] }.compact.join('.')
@@version[:string] = @@version[:number].dup
if File.exists?(scope('REVISION'))
rev = File.read(scope('REVISION')).strip
rev = nil if rev !~ /^([a-f0-9]+|\(.*\))$/
end
if (rev.nil? || rev == '(unknown)') && File.exists?(scope('.git/HEAD'))
rev = File.read(scope('.git/HEAD')).strip
if rev =~ /^ref: (.*)$/
rev = File.read(scope(".git/#{$1}")).strip
end
end
if rev
if rev = revision_number
@@version[:rev] = rev
unless rev[0] == ?(
@@version[:string] << "." << rev[0...7]
end
@@version[:string] << " (#{name})"
end
@@version[:string] << " (#{name})"
@@version
end
private
def revision_number
if File.exists?(scope('REVISION'))
rev = File.read(scope('REVISION')).strip
return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
end
return unless File.exists?(scope('.git/HEAD'))
rev = File.read(scope('.git/HEAD')).strip
return rev unless rev =~ /^ref: (.*)$/
ref_name = $1
ref_file = scope(".git/#{ref_name}")
info_file = scope(".git/info/refs")
return File.read(ref_file).strip if File.exists?(ref_file)
return unless File.exists?(info_file)
File.open(info_file) do |f|
f.each do |l|
sha, ref = l.strip.split("\t", 2)
next unless ref == ref_name
return sha
end
end
return nil
end
end
end