- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest.lua
More file actions
Latest commit
50 lines (37 loc) · 893 Bytes
/
Copy pathtest.lua
File metadata and controls
50 lines (37 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package.path=package.path..';lua/?.lua'
package.cpath=package.cpath..';b/?.so'
require'git'
localr=git.repo.open('.')
localc=r:head()
print('Commit', c.id)
print(c.author)
print(c.committer)
print(c.message)
print()
c:checkout('tst')
localparent=c.parents[1]
localpc=r:commit(parent)
print('Commit', pc.id)
print(pc.author)
print(pc.committer)
print(pc.message)
print()
localtree=pc:tree()
tree:walk(function(entry, entry_path, type)
print(type, entry_path)
end)
print()
print(tree['git.lua']:content())
-- find the initial commit
while#c.parents>0do
c=r:commit(c.parents[1])
end
print(c.message)
c:tree():walk(function(entry, entry_path, type)
print(type, entry_path)
end)
os.execute('rm -rf tst2')
os.execute('mkdir tst2')
os.execute('cd tst2 && git init')
r=git.repo.open('tst2')
git.protocol.fetch('git://github.com/mkottman/lua-git.git', r)