Skip to content

Commit c9043f9

Browse files
committed
Fixed building from rockspec.
1 parent acad1ef commit c9043f9

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ include(LuaNativeObjects)
4949
configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
5050
${CMAKE_SOURCE_DIR}/build/config.h)
5151

52+
set(COMMON_CFLAGS "${COMMON_CFLAGS} -include ${CMAKE_SOURCE_DIR}/build/config.h")
53+
5254
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
5355
${CMAKE_CURRENT_BINARY_DIR}
5456
${LUA_INCLUDE_DIR})

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ luagit2
33

44
LibGit2 bindings for Lua.
55

6+
Installing
7+
----------
8+
9+
### Install lua-git2:
10+
11+
curl -O "https://github.com/Neopallium/luagit2/raw/master/lua-git2-scm-0.rockspec"
12+
13+
luarocks install lua-git2-scm-0.rockspec
14+
15+
616
Build Dependencies
717
------------------
818

git2.nobj.lua

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use_globals = false,
55
hide_meta_info = false, --true,
66

77
include "git2.h",
8-
include "config.h",
98

109
package "GIT" {
1110
const "SUCCESS" { 0 },

pre_generated-git2.nobj.c

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "lualib.h"
1212

1313
#include "git2.h"
14-
#include "config.h"
1514

1615

1716
#define REG_PACKAGE_IS_CONSTRUCTOR 0

test_backend.lua

+10-4
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ on_free = function()
8282
end,
8383
}
8484

85-
local backend = git2.DatabaseBackend(cbs, 1)
85+
local backend = git2.DatabaseBackend(cbs, 0)
8686

87-
print('add backend:', assert(db:add_backend(backend)))
87+
--print('add backend:', assert(db:add_backend(backend)))
8888

8989
print('create test blob:')
9090
local raw_obj = git2.RawObject.new('blob',"any ol content will do")
@@ -112,7 +112,14 @@ end
112112
local status, rep = pcall(git2.Repository.open_no_backend,
113113
git_path, git_path .. 'objects', git_path .. 'index', git_path .. '../')
114114

115-
print(status, rep)
115+
if not status then
116+
print("Creating repository from git repository:", git_path)
117+
rep = git2.Repository.open(git_path)
118+
else
119+
print("Created repository with no backends from git repository:", git_path)
120+
end
121+
db = rep:database()
122+
print("add backend repository's database:", assert(db:add_backend(backend)))
116123

117124
print()
118125
print("try reading objects from repository:")
@@ -126,7 +133,6 @@ for _,obj in ipairs(object_ids) do
126133
local oid = git2.OID.str(obj[2])
127134
local obj, err = rep:lookup(oid, obj[1])
128135
print('read', obj, err)
129-
dump_rawobj(obj)
130136
print()
131137
end
132138

0 commit comments

Comments
 (0)