Module: GitDB

Defined in:
lib/git-db.rb

Defined Under Namespace

Modules: Commands, Objects, Utility Classes: Database, Pack, Protocol

Constant Summary

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)

Class Method Details

+ (Object) database(repository)

database ##################################################################



57
58
59
# File 'lib/git-db.rb', line 57

def self.database(repository)
  GitDB::Database.database(repository)
end

+ (Object) hex_to_sha1(hex)



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

+ (Object) log(message)



51
52
53
# File 'lib/git-db.rb', line 51

def self.log(message)
  logger.puts message if ENV["DEBUG"]
end

+ (Object) logger

logging ###################################################################



47
48
49
# File 'lib/git-db.rb', line 47

def self.logger
  @logger ||= STDERR
end

+ (Object) null_sha1



41
42
43
# File 'lib/git-db.rb', line 41

def self.null_sha1
  "0000000000000000000000000000000000000000"
end

+ (Object) sha1_to_hex(sha)

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