lib/docman/git_util.rb in docman-0.0.17 vs lib/docman/git_util.rb in docman-0.0.18
- old
+ new
@@ -45,17 +45,22 @@
end
exec "git clone #{single_branch} #{depth} #{repo} #{path}"
Dir.chdir path
exec "git checkout #{version}"
end
- result = type == 'branch' ? self.last_revision : version
+ result = type == 'branch' ? self.last_revision(path) : version
result
end
- def self.last_revision
- result = `git rev-parse --short HEAD`
- result.delete!("\n")
+ def self.last_revision(path = nil)
+ result = nil
+ if self.repo? path
+ Dir.chdir path unless path.nil?
+ result = `git rev-parse --short HEAD`
+ result.delete!("\n")
+ end
+ result
end
def self.update(path)
pull path
end
\ No newline at end of file