6 header = '%s %d\0' % (type, len(s))
10 dir = '.git/objects/%s' % hex[0:2]
11 fn = '%s/%s' % (dir, hex[2:])
12 if not os.path.exists(fn):
13 #log('creating %s' % fn)
17 if e.errno != errno.EEXIST:
19 tfn = '%s.%d' % (fn, os.getpid())
21 z = zlib.compressobj(1)
22 f.write(z.compress(header))
23 f.write(z.compress(s))
28 #log('exists %s' % fn)
34 return hash_raw('blob', blob)
37 def gen_tree(shalist):
38 l = ['%s %s\0%s' % (mode,name,hex.decode('hex'))
39 for (mode,name,hex) in shalist]
40 return hash_raw('tree', ''.join(l))