summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert G. Jakabosky <bobby@neoawareness.com>2011-01-07 04:09:39 -0800
committerRobert G. Jakabosky <bobby@neoawareness.com>2011-01-07 04:09:39 -0800
commit0a953e98d873a2344a3296852401c6e7722fb4a3 (patch)
tree846cb7570a8fcdf3cfbf1a57c1d7c77830c9f645
downloadluagit2-0a953e98d873a2344a3296852401c6e7722fb4a3.tar.gz
Complete un-tested bindings for full API except git_odb_backend.
-rwxr-xr-xCMakeLists.txt56
-rw-r--r--README.md0
-rw-r--r--blob.nobj.lua69
-rw-r--r--cmake/LuaNativeObjects.cmake24
-rw-r--r--commit.nobj.lua82
-rw-r--r--database.nobj.lua75
-rw-r--r--error.nobj.lua30
-rw-r--r--git2.nobj.lua28
-rw-r--r--index.nobj.lua68
-rw-r--r--index_entry.nobj.lua157
-rw-r--r--object.nobj.lua54
-rw-r--r--oid.nobj.lua56
-rw-r--r--otype.nobj.lua34
-rw-r--r--rawobject.nobj.lua86
-rw-r--r--repository.nobj.lua78
-rw-r--r--revwalk.nobj.lua56
-rw-r--r--signature.nobj.lua47
-rw-r--r--tag.nobj.lua67
-rw-r--r--template.nobj.lua45
-rw-r--r--test_rep.lua20
-rw-r--r--tree.nobj.lua67
-rw-r--r--tree_entry.nobj.lua54
22 files changed, 1253 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755
index 0000000..be0b995
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,56 @@
+#
+# Lua bindings for libgit2
+#
+cmake_minimum_required(VERSION 2.8)
+
+project(lua-git2 C)
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+
+set(INSTALL_CMOD share/lua/cmod CACHE PATH "Directory to install Lua binary modules (configure lua via LUA_CPATH)")
+set(LUA_NATIVE_OBJECTS_PATH ../LuaNativeObjects CACHE PATH
+ "Directory to LuaNativeObjects bindings generator.")
+
+set(COMMON_CFLAGS)
+set(COMMON_LDFLAGS)
+set(COMMON_LIBS)
+
+## Lua 5.1.x
+include(FindLua51)
+if(!${LUA51_FOUND})
+ message(FATAL_ERROR "The FindLua51 module could not find lua :-(")
+endif()
+set(COMMON_LIBS "${COMMON_LIBS};${LUA_LIBRARIES}")
+
+## LibGit2
+include(FindPkgConfig)
+pkg_search_module(GIT2 REQUIRED libgit2)
+set(COMMON_CFLAGS "${COMMON_CFLAGS} ${GIT2_CFLAGS}")
+set(COMMON_LDFLAGS "${COMMON_LDFLAGS} ${GIT2_LDFLAGS}")
+set(COMMON_LIBS "${COMMON_LIBS};${GIT2_LIBRARIES}")
+
+## LuaNativeObjects
+include(LuaNativeObjects)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}
+ ${LUA_INCLUDE_DIR})
+
+## LuaGit2
+set(LUA_GIT2_SRC
+ git2.nobj.lua
+)
+
+# Generate Lua bindings.
+GenLuaNativeObjects(LUA_GIT2_SRC)
+
+add_library(lua-git2 MODULE ${LUA_GIT2_SRC})
+target_link_libraries(lua-git2 ${COMMON_LIBS})
+set_target_properties(lua-git2 PROPERTIES PREFIX "")
+set_target_properties(lua-git2 PROPERTIES COMPILE_FLAGS "${COMMON_CFLAGS}")
+set_target_properties(lua-git2 PROPERTIES OUTPUT_NAME git2)
+
+install(TARGETS lua-git2
+ DESTINATION "${INSTALL_CMOD}")
+
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/README.md
diff --git a/blob.nobj.lua b/blob.nobj.lua
new file mode 100644
index 0000000..ca16b00
--- /dev/null
+++ b/blob.nobj.lua
@@ -0,0 +1,69 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_blob Blob;
+]]
+
+object "Blob" {
+ extends "Object",
+ constructor "new" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_blob_new(&(${this}), ${repo});
+]],
+ },
+ constructor "lookup" {
+ var_in{"Repository *", "repo"},
+ var_in{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_blob_lookup(&(${this}), ${repo}, &(${id}));
+]],
+ },
+ c_function "writefile" {
+ var_in{"Repository *", "repo"},
+ var_in{"const char *", "path"},
+ var_out{"OID", "written_id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_blob_writefile(&(${written_id}), ${repo}, ${path});
+]],
+ },
+ method "set_rawcontent_fromfile" {
+ c_call "GitError" "git_blob_set_rawcontent_fromfile" { "const char *", "filename" }
+ },
+ method "set_rawcontent" {
+ var_in{"const char *", "buffer"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_blob_set_rawcontent(${this}, ${buffer}, ${buffer}_len);
+]]
+ },
+ method "rawcontent" {
+ var_out{"const char *", "buffer", has_length = true},
+ c_source [[
+ ${buffer} = git_blob_rawcontent(${this});
+ ${buffer}_len = git_blob_rawsize(${this});
+]]
+ },
+}
+
diff --git a/cmake/LuaNativeObjects.cmake b/cmake/LuaNativeObjects.cmake
new file mode 100644
index 0000000..be52e59
--- /dev/null
+++ b/cmake/LuaNativeObjects.cmake
@@ -0,0 +1,24 @@
+#
+# Lua Native Objects
+#
+macro(GenLuaNativeObjects _src_files_var)
+ set(_new_src_files)
+ foreach(_src_file ${${_src_files_var}})
+ if(_src_file MATCHES ".nobj.lua")
+ string(REGEX REPLACE ".nobj.lua" ".nobj.c" _src_file_out ${_src_file})
+ string(REGEX REPLACE ".nobj.lua" ".nobj.h" _header_file_out ${_src_file})
+ add_custom_command(OUTPUT ${_src_file_out} ${_header_file_out}
+ COMMAND lua ${LUA_NATIVE_OBJECTS_PATH}/api_gen.lua -outpath ${CMAKE_CURRENT_BINARY_DIR} -gen lua ${_src_file}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${_src_file}
+ )
+ set_source_files_properties(${_src_file_out} PROPERTIES GENERATED TRUE)
+ set_source_files_properties(${_header_file_out} PROPERTIES GENERATED TRUE)
+ set(_new_src_files ${_new_src_files} ${_src_file_out})
+ else(_src_file MATCHES ".nobj.lua")
+ set(_new_src_files ${_new_src_files} ${_src_file})
+ endif(_src_file MATCHES ".nobj.lua")
+ endforeach(_src_file)
+ set(${_src_files_var} ${_new_src_files})
+endmacro(GenLuaNativeObjects _src_files_var)
+
diff --git a/commit.nobj.lua b/commit.nobj.lua
new file mode 100644
index 0000000..ab746b4
--- /dev/null
+++ b/commit.nobj.lua
@@ -0,0 +1,82 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_commit Commit;
+]]
+
+object "Commit" {
+ extends "Object",
+ constructor "new" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_commit_new(&(${this}), ${repo});
+]],
+ },
+ constructor "lookup" {
+ var_in{"Repository *", "repo"},
+ var_in{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_commit_lookup(&(${this}), ${repo}, &(${id}));
+]],
+ },
+ method "message" {
+ c_call "const char *" "git_commit_message" {}
+ },
+ method "message_short" {
+ c_call "const char *" "git_commit_message_short" {}
+ },
+ method "set_message" {
+ c_call "void" "git_commit_set_message" { "const char *", "message" }
+ },
+ method "time" {
+ c_call "time_t" "git_commit_time" {}
+ },
+ method "committer" {
+ c_call "const Signature *" "git_commit_committer" {}
+ },
+ method "set_committer" {
+ c_call "void" "git_commit_set_committer" { "const Signature *", "sig" }
+ },
+ method "author" {
+ c_call "const Signature *" "git_commit_author" {}
+ },
+ method "set_author" {
+ c_call "void" "git_commit_set_author" { "const Signature *", "sig" }
+ },
+ method "tree" {
+ c_call "const Tree *" "git_commit_tree" {}
+ },
+ method "set_tree" {
+ c_call "void" "git_commit_set_tree" { "Tree *", "tree" }
+ },
+ method "parentcount" {
+ c_call "unsigned int" "git_commit_parentcount" {}
+ },
+ method "parent" {
+ c_call "Commit *" "git_commit_parent" { "unsigned int", "n" }
+ },
+ method "add_parent" {
+ c_call "GitError" "git_commit_add_parent" { "Commit *", "parent" }
+ },
+}
+
diff --git a/database.nobj.lua b/database.nobj.lua
new file mode 100644
index 0000000..0bc7cb7
--- /dev/null
+++ b/database.nobj.lua
@@ -0,0 +1,75 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_odb Database;
+]]
+
+object "Database" {
+ constructor "new" {
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_new(&(${this}));
+]],
+ },
+ constructor "open" {
+ var_in{"const char *", "object_dir"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_open(&(${this}), ${object_dir});
+]],
+ },
+ destructor "close" {
+ c_call "void" "git_odb_close" {}
+ },
+ -- TODO: add_backend
+ method "read" {
+ var_in{"OID", "id"},
+ var_out{"RawObject", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_read(&(${obj}.raw), ${this}, &(${id}));
+]],
+ },
+ method "read_header" {
+ var_in{"OID", "id"},
+ var_out{"RawObject", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_read_header(&(${obj}.raw), ${this}, &(${id}));
+]],
+ },
+ method "write" {
+ var_in{"OID", "id"},
+ var_in{"RawObject", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_write(&(${id}), ${this}, &(${obj}.raw));
+]],
+ },
+ method "exists" {
+ var_in{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_odb_exists(${this}, &(${id}));
+]],
+ },
+}
+
diff --git a/error.nobj.lua b/error.nobj.lua
new file mode 100644
index 0000000..7acb4f5
--- /dev/null
+++ b/error.nobj.lua
@@ -0,0 +1,30 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+-- Convert Git Error codes into strings.
+error_code "GitError" "int" {
+ default = "GIT_SUCCESS",
+ c_source [[
+ if(err != GIT_SUCCESS) {
+ err_str = git_strerror(err);
+ }
+]],
+}
+
diff --git a/git2.nobj.lua b/git2.nobj.lua
new file mode 100644
index 0000000..a7292e9
--- /dev/null
+++ b/git2.nobj.lua
@@ -0,0 +1,28 @@
+
+c_module "git2" {
+-- module settings.
+use_globals = false,
+hide_meta_info = false, --true,
+
+include "git2.h",
+
+subfiles {
+"repository.nobj.lua",
+"database.nobj.lua",
+"rawobject.nobj.lua",
+"index.nobj.lua",
+"index_entry.nobj.lua",
+"otype.nobj.lua",
+"oid.nobj.lua",
+"error.nobj.lua",
+"object.nobj.lua",
+"blob.nobj.lua",
+"signature.nobj.lua",
+"commit.nobj.lua",
+"tree.nobj.lua",
+"tree_entry.nobj.lua",
+"tag.nobj.lua",
+"revwalk.nobj.lua",
+},
+}
+
diff --git a/index.nobj.lua b/index.nobj.lua
new file mode 100644
index 0000000..e1ca3a5
--- /dev/null
+++ b/index.nobj.lua
@@ -0,0 +1,68 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_index Index;
+]]
+
+object "Index" {
+ constructor "bare" {
+ var_in{"const char *", "index_path"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_index_open_bare(&(${this}), ${index_path});
+]],
+ },
+ constructor "inrepo" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_index_open_inrepo(&(${this}), ${repo});
+]],
+ },
+ destructor {
+ c_call "void" "git_index_free" {}
+ },
+ method "clear" {
+ c_call "void" "git_index_clear" {}
+ },
+ method "read" {
+ c_call "GitError" "git_index_read" {}
+ },
+ method "find" {
+ c_call "int" "git_index_find" { "const char *", "path" }
+ },
+ method "add" {
+ c_call "GitError" "git_index_add" { "const char *", "path", "int", "stage" }
+ },
+ method "remove" {
+ c_call "GitError" "git_index_remove" { "int", "position" }
+ },
+ method "insert" {
+ c_call "GitError" "git_index_insert" { "IndexEntry *", "source_entry" }
+ },
+ method "get" {
+ c_call "IndexEntry *" "git_index_get" { "int", "n" }
+ },
+ method "entrycount" {
+ c_call "unsigned int" "git_index_entrycount" {}
+ },
+}
+
diff --git a/index_entry.nobj.lua b/index_entry.nobj.lua
new file mode 100644
index 0000000..20a17c3
--- /dev/null
+++ b/index_entry.nobj.lua
@@ -0,0 +1,157 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_index_entry IndexEntry;
+]]
+
+object "IndexEntry" {
+ constructor {
+ c_source [[
+ ${this} = calloc(1, sizeof(IndexEntry));
+]],
+ },
+ destructor {
+ c_source [[
+ if(${this}->path != NULL) {
+ free(${this}->path);
+ }
+ free(${this});
+]]
+ },
+ method "ctime" {
+ var_out{"time_t", "secs"},
+ var_out{"time_t", "nanosecs"},
+ c_source [[
+ ${secs} = ${this}->ctime.seconds;
+ ${nanosecs} = ${this}->ctime.nanoseconds;
+]]
+ },
+ method "set_ctime" {
+ var_in{"time_t", "secs"},
+ var_in{"time_t", "nanosecs"},
+ c_source [[
+ ${this}->ctime.seconds = ${secs};
+ ${this}->ctime.nanoseconds = ${nanosecs};
+]]
+ },
+ method "mtime" {
+ var_out{"time_t", "secs"},
+ var_out{"time_t", "nanosecs"},
+ c_source [[
+ ${secs} = ${this}->mtime.seconds;
+ ${nanosecs} = ${this}->mtime.nanoseconds;
+]]
+ },
+ method "set_mtime" {
+ var_in{"time_t", "secs"},
+ var_in{"time_t", "nanosecs"},
+ c_source [[
+ ${this}->mtime.seconds = ${secs};
+ ${this}->mtime.nanoseconds = ${nanosecs};
+]]
+ },
+ method "dev" {
+ var_out{"unsigned int", "ret"},
+ c_source "${ret} = ${this}->dev;"
+ },
+ method "set_dev" {
+ var_in{"unsigned int", "val"},
+ c_source "${this}->dev = ${val};"
+ },
+ method "ino" {
+ var_out{"unsigned int", "ret"},
+ c_source "${ret} = ${this}->ino;"
+ },
+ method "set_ino" {
+ var_in{"unsigned int", "val"},
+ c_source "${this}->ino = ${val};"
+ },
+ method "mode" {
+ var_out{"unsigned int", "ret"},
+ c_source "${ret} = ${this}->mode;"
+ },
+ method "set_mode" {
+ var_in{"unsigned int", "val"},
+ c_source "${this}->mode = ${val};"
+ },
+ method "uid" {
+ var_out{"unsigned int", "ret"},
+ c_source "${ret} = ${this}->uid;"
+ },
+ method "set_uid" {
+ var_in{"unsigned int", "val"},
+ c_source "${this}->uid = ${val};"
+ },
+ method "gid" {
+ var_out{"unsigned int", "ret"},
+ c_source "${ret} = ${this}->gid;"
+ },
+ method "set_gid" {
+ var_in{"unsigned int", "val"},
+ c_source "${this}->gid = ${val};"
+ },
+ method "file_size" {
+ var_out{"off_t", "ret"},
+ c_source "${ret} = ${this}->file_size;"
+ },
+ method "set_file_size" {
+ var_in{"off_t", "val"},
+ c_source "${this}->file_size = ${val};"
+ },
+ method "id" {
+ var_out{"OID", "ret"},
+ c_source "${ret} = ${this}->oid;"
+ },
+ method "set_id" {
+ var_in{"OID", "val"},
+ c_source "${this}->oid = ${val};"
+ },
+ method "flags" {
+ var_out{"unsigned short", "ret"},
+ c_source "${ret} = ${this}->flags;"
+ },
+ method "set_flags" {
+ var_in{"unsigned short", "val"},
+ c_source "${this}->flags = ${val};"
+ },
+ method "flags_extended" {
+ var_out{"unsigned short", "ret"},
+ c_source "${ret} = ${this}->flags_extended;"
+ },
+ method "set_flags_extended" {
+ var_in{"unsigned short", "val"},
+ c_source "${this}->flags_extended = ${val};"
+ },
+ method "path" {
+ var_out{"const char *", "ret"},
+ c_source "${ret} = ${this}->path;"
+ },
+ method "set_path" {
+ var_in{"const char *", "val"},
+ c_source [[
+ if(${this}->path != NULL) {
+ free(${this}->path);
+ }
+ ${this}->path = strndup(${val}, ${val}_len);
+]]
+ },
+}
+
diff --git a/object.nobj.lua b/object.nobj.lua
new file mode 100644
index 0000000..d406e64
--- /dev/null
+++ b/object.nobj.lua
@@ -0,0 +1,54 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_object Object;
+]]
+
+object "Object" {
+ dyn_caster {
+ caster_type = "switch",
+ value_function = "git_object_type",
+ value_map = {
+ GIT_OBJ_BLOB = "Blob",
+ GIT_OBJ_COMMIT = "Commit",
+ GIT_OBJ_TREE = "Tree",
+ },
+ },
+ destructor {
+ c_call "void" "git_object_free" {}
+ },
+ method "write" {
+ c_call "GitError" "git_object_write" {}
+ },
+ method "id" {
+ var_out{ "OID", "id" },
+ c_source [[
+ ${id} = *(git_object_id(${this}));
+]]
+ },
+ method "type" {
+ c_call "OType" "git_object_type" {}
+ },
+ method "owner" {
+ c_call "Repository *" "git_object_owner" {}
+ },
+}
+
diff --git a/oid.nobj.lua b/oid.nobj.lua
new file mode 100644
index 0000000..ec69690
--- /dev/null
+++ b/oid.nobj.lua
@@ -0,0 +1,56 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_oid OID;
+]]
+
+object "OID" {
+ userdata_type = 'simple',
+ constructor "str" {
+ var_in{"const char *", "hex"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_oid_mkstr(&(${this}), ${hex});
+]],
+ },
+ constructor "raw" {
+ var_in{"const unsigned char *", "raw"},
+ c_source [[
+ git_oid_mkraw(&(${this}), ${raw});
+]],
+ },
+ method "__str__" {
+ var_out{"const char *", "ret"},
+ c_source [[
+ char buf[GIT_OID_HEXSZ];
+ git_oid_fmt(buf, &(${this}));
+ ${ret} = buf;
+]],
+ },
+ method "__eq__" {
+ var_in{"OID", "id"},
+ var_out{"int", "ret"},
+ c_source [[
+ ${ret} = git_oid_cmp(&(${this}), &(${id}));
+]],
+ },
+}
+
diff --git a/otype.nobj.lua b/otype.nobj.lua
new file mode 100644
index 0000000..4b91023
--- /dev/null
+++ b/otype.nobj.lua
@@ -0,0 +1,34 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_otype OType;
+]]
+
+object "OType" {
+ userdata_type = 'simple',
+ constructor {
+ c_call "OType" "git_object_string2type" {"const char *", "str"}
+ },
+ method "__str__" {
+ c_call "const char *" "git_object_type2string" {}
+ },
+}
+
diff --git a/rawobject.nobj.lua b/rawobject.nobj.lua
new file mode 100644
index 0000000..d0261c4
--- /dev/null
+++ b/rawobject.nobj.lua
@@ -0,0 +1,86 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef struct RawObject {
+ git_rawobj raw;
+ int ref;
+} RawObject;
+]]
+
+object "RawObject" {
+ userdata_type = 'simple',
+ default = '{ .raw = { .data = NULL, .len = 0, .type = GIT_OBJ_BAD }, .ref = LUA_NOREF }',
+ constructor {
+ var_in{"OType", "type"},
+ var_in{"const char *", "data"},
+ c_source [[
+ ${this}.raw.data = (void *)${data};
+ ${this}.raw.len = ${data}_len;
+ ${this}.raw.type = ${type};
+ if(${data}) {
+ /* keep a reference to the Lua string. */
+ lua_pushvalue(L, ${data::idx});
+ ${this}.ref = luaL_ref(L, LUA_REGISTRYINDEX);
+ } else {
+ ${this}.ref = LUA_NOREF;
+ }
+]],
+ },
+ destructor "close" {
+ c_source [[
+ if(${this}.ref == LUA_NOREF) {
+ if(${this}.raw.data != NULL) {
+ git_rawobj_close(&(${this}.raw));
+ }
+ } else {
+ /* this raw object was pointing to a Lua string, release our reference to it. */
+ luaL_unref(L, LUA_REGISTRYINDEX, ${this}.ref);
+ }
+]],
+ },
+ method "data" {
+ var_out{"const char *", "data", has_length = true},
+ c_source [[
+ ${data} = ${this}.raw.data;
+ ${data}_len = ${this}.raw.len;
+]],
+ },
+ method "len" {
+ var_out{"size_t", "len"},
+ c_source [[
+ ${len} = ${this}.raw.len;
+]],
+ },
+ method "type" {
+ var_out{"OType", "type"},
+ c_source [[
+ ${type} = ${this}.raw.type;
+]],
+ },
+ method "hash" {
+ var_out{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_rawobj_hash(&(${id}), &(${this}.raw));
+]],
+ },
+}
+
diff --git a/repository.nobj.lua b/repository.nobj.lua
new file mode 100644
index 0000000..c8de1f0
--- /dev/null
+++ b/repository.nobj.lua
@@ -0,0 +1,78 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_repository Repository;
+]]
+
+object "Repository" {
+ constructor "open" {
+ var_in{"const char *", "path"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_repository_open(&(${this}), ${path});
+]],
+ },
+ constructor "open2" {
+ var_in{"const char *", "dir"},
+ var_in{"const char *", "object_directory"},
+ var_in{"const char *", "index_file"},
+ var_in{"const char *", "work_tree"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_repository_open2(&(${this}), ${dir}, ${object_directory}, ${index_file}, ${work_tree});
+]],
+ },
+ destructor {
+ c_call "void" "git_repository_free" {}
+ },
+ method "database" {
+ c_call "Database *" "git_repository_database" {}
+ },
+ method "index" {
+ c_call "Index *" "git_repository_index" {}
+ },
+ method "lookup" {
+ var_in{"OID", "id"},
+ var_in{"OType", "type"},
+ var_out{"Object *", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_repository_lookup(&(${obj}), ${this}, &(${id}), ${type});
+]],
+ },
+ method "newobject" {
+ var_in{"OType", "type"},
+ var_out{"Object *", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_repository_newobject(&(${obj}), ${this}, ${type});
+]],
+ },
+ method "blob_writefile" {
+ var_in{"const char *", "path"},
+ var_out{"OID", "written_id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_blob_writefile(&(${written_id}), ${this}, ${path});
+]],
+ },
+}
+
diff --git a/revwalk.nobj.lua b/revwalk.nobj.lua
new file mode 100644
index 0000000..8dab65f
--- /dev/null
+++ b/revwalk.nobj.lua
@@ -0,0 +1,56 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_revwalk RevWalk;
+]]
+
+object "RevWalk" {
+ extends "Object",
+ constructor "new" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_revwalk_new(&(${this}), ${repo});
+]],
+ },
+ destructor {
+ c_call "void" "git_revwalk_free" {}
+ },
+ method "reset" {
+ c_call "void" "git_revwalk_reset" {}
+ },
+ method "push" {
+ c_call "GitError" "git_revwalk_push" { "Commit *", "commit" }
+ },
+ method "hide" {
+ c_call "GitError" "git_revwalk_hide" { "Commit *", "commit" }
+ },
+ method "next" {
+ c_call "Commit *" "git_revwalk_next" {}
+ },
+ method "sorting" {
+ c_call "GitError" "git_revwalk_sorting" { "unsigned int", "sort_mode" }
+ },
+ method "repository" {
+ c_call "Repository *" "git_revwalk_repository" {}
+ },
+}
+
diff --git a/signature.nobj.lua b/signature.nobj.lua
new file mode 100644
index 0000000..6e1fa62
--- /dev/null
+++ b/signature.nobj.lua
@@ -0,0 +1,47 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_signature Signature;
+]]
+
+object "Signature" {
+ constructor {
+ c_call "Signature *" "git_signature_new"
+ { "const char *", "name", "const char *", "email", "time_t", "time", "int", "offset" },
+ },
+ destructor {
+ c_call "void" "git_signature_free" {},
+ },
+ method "name" {
+ var_out{"const char *", "name"},
+ c_source "${name} = ${this}->name;",
+ },
+ method "email" {
+ var_out{"const char *", "email"},
+ c_source "${email} = ${this}->email;",
+ },
+ method "when" {
+ var_out{"time_t", "time"},
+ var_out{"int", "offset"},
+ c_source "${time} = ${this}->when.time; ${offset} = ${this}->when.offset;",
+ },
+}
+
diff --git a/tag.nobj.lua b/tag.nobj.lua
new file mode 100644
index 0000000..ce83788
--- /dev/null
+++ b/tag.nobj.lua
@@ -0,0 +1,67 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_tag Tag;
+]]
+
+object "Tag" {
+ extends "Object",
+ constructor "new" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tag_new(&(${this}), ${repo});
+]],
+ },
+ constructor "lookup" {
+ var_in{"Repository *", "repo"},
+ var_in{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tag_lookup(&(${this}), ${repo}, &(${id}));
+]],
+ },
+ method "target" {
+ c_call "const Object *" "git_tag_target" {}
+ },
+ method "set_target" {
+ c_call "void" "git_tag_set_target" { "Object *", "target" }
+ },
+ method "name" {
+ c_call "const char *" "git_tag_name" {}
+ },
+ method "set_name" {
+ c_call "void" "git_tag_set_name" { "const char *", "name" }
+ },
+ method "tagger" {
+ c_call "const Signature *" "git_tag_tagger" {}
+ },
+ method "set_tagger" {
+ c_call "void" "git_tag_set_tagger" { "const Signature *", "tagger" }
+ },
+ method "message" {
+ c_call "const char *" "git_tag_message" {}
+ },
+ method "set_message" {
+ c_call "void" "git_tag_set_message" { "const char *", "message" }
+ },
+}
+
diff --git a/template.nobj.lua b/template.nobj.lua
new file mode 100644
index 0000000..39f767e
--- /dev/null
+++ b/template.nobj.lua
@@ -0,0 +1,45 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+--[[
+vi commands:
+:%s/<newname>/<newname>/g
+:%s/<NewName>/<NewName>/g
+]]
+
+c_source [[
+typedef git_<newname> <NewName>;
+]]
+
+object "<NewName>" {
+ constructor {
+ c_call "<NewName> *" "git_<newname>_new" {}
+ },
+ destructor {
+ c_call "void" "git_<newname>_free" {}
+ },
+ method "set_name" {
+ c_call "void" "git_<newname>_set_name" {"const char *", "name"}
+ },
+ method "get_name" {
+ c_call "const char *" "git_<newname>_get_name" {}
+ },
+}
+
diff --git a/test_rep.lua b/test_rep.lua
new file mode 100644
index 0000000..959570b
--- /dev/null
+++ b/test_rep.lua
@@ -0,0 +1,20 @@
+#!/usr/bin/env lua
+
+-- Make it easier to test
+local src_dir, build_dir = ...
+if ( src_dir ) then
+ package.path = src_dir .. "?.lua;" .. package.path
+ package.cpath = build_dir .. "?.so;" .. package.cpath
+end
+
+require"git2"
+require"utils"
+
+print("dump git2 interface")
+print(dbg_dump(git2))
+
+local rep = assert(git2.Repository.open("./test_rep/.git"))
+
+
+print("finished")
+
diff --git a/tree.nobj.lua b/tree.nobj.lua
new file mode 100644
index 0000000..dbcd10e
--- /dev/null
+++ b/tree.nobj.lua
@@ -0,0 +1,67 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_tree Tree;
+]]
+
+object "Tree" {
+ extends "Object",
+ constructor "new" {
+ var_in{"Repository *", "repo"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tree_new(&(${this}), ${repo});
+]],
+ },
+ constructor "lookup" {
+ var_in{"Repository *", "repo"},
+ var_in{"OID", "id"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tree_lookup(&(${this}), ${repo}, &(${id}));
+]],
+ },
+ method "entrycount" {
+ c_call "size_t" "git_tree_entrycount" {}
+ },
+ method "entry_byname" {
+ c_call "TreeEntry *" "git_tree_entry_byname" { "const char *", "filename" }
+ },
+ method "entry_byindex" {
+ c_call "TreeEntry *" "git_tree_entry_byindex" { "int", "index" }
+ },
+ method "add_entry" {
+ var_in{"const OID", "id"},
+ var_in{"const char *", "filename"},
+ var_in{"int", "attributes"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tree_add_entry(${this}, &(${id}), ${filename}, ${attributes});
+]],
+ },
+ method "remove_entry_byname" {
+ c_call "GitError" "git_tree_remove_entry_byname" { "const char *", "filename" }
+ },
+ method "remove_entry_byindex" {
+ c_call "GitError" "git_tree_remove_entry_byindex" { "int", "index" }
+ },
+}
+
diff --git a/tree_entry.nobj.lua b/tree_entry.nobj.lua
new file mode 100644
index 0000000..5eddfa8
--- /dev/null
+++ b/tree_entry.nobj.lua
@@ -0,0 +1,54 @@
+-- Copyright (c) 2010 by Robert G. Jakabosky <bobby@neoawareness.com>
+--
+-- Permission is hereby granted, free of charge, to any person obtaining a copy
+-- of this software and associated documentation files (the "Software"), to deal
+-- in the Software without restriction, including without limitation the rights
+-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-- copies of the Software, and to permit persons to whom the Software is
+-- furnished to do so, subject to the following conditions:
+--
+-- The above copyright notice and this permission notice shall be included in
+-- all copies or substantial portions of the Software.
+--
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-- THE SOFTWARE.
+
+c_source [[
+typedef git_tree_entry TreeEntry;
+]]
+
+object "TreeEntry" {
+ method "name" {
+ c_call "const char *" "git_tree_entry_name" {}
+ },
+ method "set_name" {
+ c_call "void" "git_tree_entry_set_name" {"const char *", "name"}
+ },
+ method "attributes" {
+ c_call "unsigned int" "git_tree_entry_attributes" {}
+ },
+ method "set_attributes" {
+ c_call "void" "git_tree_entry_set_attributes" {"int", "attr"}
+ },
+ method "id" {
+ var_out{"OID", "id"},
+ c_source "${id} = *(git_tree_entry_id(${this}));"
+ },
+ method "set_id" {
+ var_in{"OID", "id"},
+ c_source "git_tree_entry_set_id(${this}, &(${id}));"
+ },
+ method "object" {
+ var_out{"Object *", "obj"},
+ var_out{"GitError", "err"},
+ c_source [[
+ ${err} = git_tree_entry_2object(&(${obj}), ${this});
+]]
+ },
+}
+