Module: GitDB
- Defined in:
- lib/git-db.rb
Defined Under Namespace
Modules: Commands, Objects, Utility Classes: Database, Pack, Protocol
Constant Summary collapse
- OBJ_NONE =
git constants #############################################################
0
- OBJ_COMMIT =
1
- OBJ_TREE =
2
- OBJ_BLOB =
3
- OBJ_TAG =
4
- OBJ_OFS_DELTA =
6
- OBJ_REF_DELTA =
7
Class Method Summary collapse
-
.database(repository) ⇒ Object
database ##################################################################.
- .hex_to_sha1(hex) ⇒ Object
- .log(message) ⇒ Object
-
.logger ⇒ Object
logging ###################################################################.
- .null_sha1 ⇒ Object
-
.sha1_to_hex(sha) ⇒ Object
git utility ###############################################################.
Class Method Details
.database(repository) ⇒ Object
database ##################################################################
57 58 59 |
# File 'lib/git-db.rb', line 57 def self.database(repository) GitDB::Database.database(repository) end |
.hex_to_sha1(hex) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/git-db.rb', line 29 def self.hex_to_sha1(hex) sha = "" len = 0 until (len == hex.length) val = (hex[len, 1].to_i(16) << 4) val += hex[len+1, 1].to_i(16) sha << val.chr len += 2 end sha end |
.log(message) ⇒ Object
51 52 53 |
# File 'lib/git-db.rb', line 51 def self.log() logger.puts if ENV["DEBUG"] end |
.logger ⇒ Object
logging ###################################################################
47 48 49 |
# File 'lib/git-db.rb', line 47 def self.logger @logger ||= STDERR end |
.null_sha1 ⇒ Object
41 42 43 |
# File 'lib/git-db.rb', line 41 def self.null_sha1 "0000000000000000000000000000000000000000" end |
.sha1_to_hex(sha) ⇒ Object
git utility ###############################################################
19 20 21 22 23 24 25 26 27 |
# File 'lib/git-db.rb', line 19 def self.sha1_to_hex(sha) hex = "" sha.split('').each do |char| val = char[0] hex << (val >> 4).to_s(16) hex << (val & 0xf).to_s(16) end hex end |