diff --git a/git2.nobj.lua b/git2.nobj.lua index 3a202f9..d98cdbb 100644 --- a/git2.nobj.lua +++ b/git2.nobj.lua @@ -58,6 +58,16 @@ c_function "version" { ]], }, subfiles { +"src/checkout_options.nobj.lua", +"src/diff_find_options.nobj.lua", +"src/diff_options.nobj.lua", +"src/diff_delta.nobj.lua", +"src/diff_stat.nobj.lua", +"src/diff_file.nobj.lua", +"src/diff.nobj.lua", +"src/status_options.nobj.lua", +"src/status_list.nobj.lua", +"src/status_entry.nobj.lua", "src/strarray.nobj.lua", "src/error.nobj.lua", "src/repository.nobj.lua", diff --git a/src/checkout_options.nobj.lua b/src/checkout_options.nobj.lua new file mode 100644 index 0000000..61eb31c --- /dev/null +++ b/src/checkout_options.nobj.lua @@ -0,0 +1,161 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "CheckoutOptions" { + c_source [[ +typedef git_checkout_options CheckoutOptions; +]], + constants { + VERSION = 1, + SAFE = 0, + FORCE = 2, + RECREATE_MISSING = 4, + ALLOW_CONFLICTS = 16, + REMOVE_UNTRACKED = 32, + REMOVE_IGNORED = 64, + UPDATE_ONLY = 128, + DONT_UPDATE_INDEX = 256, + NO_REFRESH = 512, + SKIP_UNMERGED = 1024, + USE_OURS = 2048, + USE_THEIRS = 4096, + DISABLE_PATHSPEC_MATCH = 8192, + SKIP_LOCKED_DIRECTORIES = 262144, + DONT_OVERWRITE_IGNORED = 524288, + CONFLICT_STYLE_MERGE = 1048576, + CONFLICT_STYLE_DIFF3 = 2097152, + DONT_REMOVE_EXISTING = 4194304, + DONT_WRITE_INDEX = 8388608, + DRY_RUN = 16777216, + CONFLICT_STYLE_ZDIFF3 = 33554432, + NONE = 1073741824, + UPDATE_SUBMODULES = 65536, + UPDATE_SUBMODULES_IF_CHANGED = 131072, + }, + constructor "init" { + c_source [[ + ${this} = calloc(1, sizeof(CheckoutOptions)); + git_checkout_options_init(${this}, GIT_STATUS_OPTIONS_VERSION); +]], + }, + destructor { + c_source [[ + free(${this}); +]] + }, + field "unsigned int" "version", + field "unsigned int" "checkout_strategy", + method "set_checkout_strategy" { + var_in { "unsigned int", "checkout_strategy" }, + c_source [[ + ${this}->checkout_strategy = ${checkout_strategy}; +]], + }, + field "int" "disable_filters", + method "set_disable_filters" { + var_in { "int", "disable_filters" }, + c_source [[ + ${this}->disable_filters = ${disable_filters}; +]], + }, + field "unsigned int" "dir_mode", + method "set_dir_mode" { + var_in { "unsigned int", "dir_mode" }, + c_source [[ + ${this}->dir_mode = ${dir_mode}; +]], + }, + field "unsigned int" "file_mode", + method "set_file_mode" { + var_in { "unsigned int", "file_mode" }, + c_source [[ + ${this}->file_mode = ${file_mode}; +]], + }, + field "int" "file_open_flags", + method "set_file_open_flags" { + var_in { "int", "file_open_flags" }, + c_source [[ + ${this}->file_open_flags = ${file_open_flags}; +]], + }, + field "unsigned int" "notify_flags", + method "set_notify_flags" { + var_in { "unsigned int", "notify_flags" }, + c_source [[ + ${this}->notify_flags = ${notify_flags}; +]], + }, + method "paths" { + var_out { "StrArray *", "paths" }, + c_source [[ + ${paths} = &${this}->paths; +]], + }, + method "set_paths" { + var_in { "StrArray *", "paths" }, + c_source [[ + ${this}->paths.strings = ${paths}->strings; + ${this}->paths.count = ${paths}->count; +]], + }, + field "Tree *" "baseline", + method "set_baseline" { + var_in { "Tree *", "baseline" }, + c_source [[ + ${this}->baseline = ${baseline}; +]], + }, + field "Index *" "baseline_index", + method "set_baseline_index" { + var_in { "Index *", "baseline_index" }, + c_source [[ + ${this}->baseline_index = ${baseline_index}; +]], + }, + field "const char *" "target_directory", + method "set_target_directory" { + var_in { "const char *", "target_directory" }, + c_source [[ + ${this}->target_directory = ${target_directory}; +]], + }, + field "const char *" "ancestor_label", + method "set_ancestor_label" { + var_in { "const char *", "ancestor_label" }, + c_source [[ + ${this}->ancestor_label = ${ancestor_label}; +]], + }, + field "const char *" "our_label", + method "set_our_label" { + var_in { "const char *", "our_label" }, + c_source [[ + ${this}->our_label = ${our_label}; +]], + }, + field "const char *" "their_label", + method "set_their_label" { + var_in { "const char *", "their_label" }, + c_source [[ + ${this}->their_label = ${their_label}; +]], + }, +} diff --git a/src/diff.nobj.lua b/src/diff.nobj.lua new file mode 100644 index 0000000..a77fc7e --- /dev/null +++ b/src/diff.nobj.lua @@ -0,0 +1,46 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "Diff" { + c_source [[ +typedef git_diff Diff; +]], + constructor "index_to_workdir" { + c_call { "GitError", "err" } "git_diff_index_to_workdir" { "Diff *", "&this>1", "Repository *", "repo", "Index *", "index", "DiffOptions *", "opts" }, + }, + constructor "tree_to_index" { + c_call { "GitError", "err" } "git_diff_tree_to_index" { "Diff *", "&this>1", "Repository *", "repo", "Tree *", "tree", "Index *", "index", "DiffOptions *", "opts" }, + }, + constructor "tree_to_workdir_with_index" { + c_call { "GitError", "err" } "git_diff_tree_to_workdir_with_index" { "Diff *", "&this>1", "Repository *", "repo", "Tree *", "tree", "DiffOptions *", "opts" }, + }, + constructor "tree_to_tree" { + c_call { "GitError", "err" } "git_diff_tree_to_tree" { "Diff *", "&this>1", "Repository *", "repo", "Tree *", "tree", "Tree *", "tree", "DiffOptions *", "opts" }, + }, + destructor { + c_method_call "void" "git_diff_free" {} + }, + method "num" { + c_method_call { "size_t", "count" } "git_diff_num_deltas" {}, + }, + method "find_similar" { + c_method_call { "GitError", "err" } "git_diff_find_similar" { "DiffFindOptions *", "opts" }, + }, +} diff --git a/src/diff_delta.nobj.lua b/src/diff_delta.nobj.lua new file mode 100644 index 0000000..b65a82f --- /dev/null +++ b/src/diff_delta.nobj.lua @@ -0,0 +1,57 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "DiffDelta" { + c_source [[ +typedef git_diff_delta DiffDelta; +]], + constants { + UNMODIFIED = 0, + ADDED = 1, + DELETED = 2, + MODIFIED = 3, + RENAMED = 4, + COPIED = 5, + IGNORED = 6, + UNTRACKED = 7, + TYPECHANGE = 8, + UNREADABLE = 9, + CONFLICTED = 10, + }, + constructor "get" { + c_call "const DiffDelta *>1" "git_diff_get_delta" { "Diff *", "diff", "size_t", "idx" }, + }, + field "unsigned int" "status", + field "uint32_t" "flags", + field "uint16_t" "similarity", + field "uint16_t" "nfiles", + method "old_file" { + var_out { "DiffFile *", "old_file" }, + c_source [[ + ${old_file} = &${this}->old_file; +]], + }, + method "new_file" { + var_out { "DiffFile *", "new_file" }, + c_source [[ + ${new_file} = &${this}->new_file; +]], + }, +} diff --git a/src/diff_file.nobj.lua b/src/diff_file.nobj.lua new file mode 100644 index 0000000..65f833f --- /dev/null +++ b/src/diff_file.nobj.lua @@ -0,0 +1,47 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "DiffFile" { + c_source [[ +typedef git_diff_file DiffFile; +]], + constants { + BINARY = 1, + NOT_BINARY = 2, + VALID_ID = 4, + EXISTS = 8, + VALID_SIZE = 16, + }, + destructor { + c_source [[ + if(${this}->path != NULL) { + free((void *)${this}->path); + ${this}->path = NULL; + } + free(${this}); +]] + }, + field "OID" "id", + field "const char *" "path", + field "uint64_t" "size", + field "uint32_t" "flags", + field "uint16_t" "mode", + field "uint16_t" "id_abbrev", +} diff --git a/src/diff_find_options.nobj.lua b/src/diff_find_options.nobj.lua new file mode 100644 index 0000000..0ef73af --- /dev/null +++ b/src/diff_find_options.nobj.lua @@ -0,0 +1,102 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "DiffFindOptions" { + c_source [[ +typedef git_diff_find_options DiffFindOptions; +]], + constants { + VERSION = 1, + BY_CONFIG = 0, + RENAMES = 1, + RENAMES_FROM_REWRITES = 2, + COPIES = 4, + COPIES_FROM_UNMODIFIED = 8, + REWRITES = 16, + AND_BREAK_REWRITES = 48, + FOR_UNTRACKED = 64, + ALL = 255, + IGNORE_LEADING_WHITESPACE = 0, + IGNORE_WHITESPACE = 4096, + DONT_IGNORE_WHITESPACE = 8192, + EXACT_MATCH_ONLY = 16384, + REMOVE_UNMODIFIED = 65536, + BREAK_REWRITES = 32, + BREAK_REWRITES_FOR_RENAMES_ONLY = 32768, + }, + constructor "init" { + c_source [[ + ${this} = calloc(1, sizeof(DiffFindOptions)); + git_diff_find_options_init(${this}, GIT_DIFF_OPTIONS_VERSION); +]], + }, + destructor { + c_source [[ + if(${this}->metric != NULL) { + free((void *)${this}->metric); + ${this}->metric = NULL; + } + free(${this}); +]] + }, + field "unsigned int" "version", + field "unsigned int" "flags", + method "set_flags" { + var_in { "unsigned int", "flags" }, + c_source [[ + ${this}->flags = ${flags}; +]], + }, + field "uint16_t" "rename_threshold", + method "set_rename_threshold" { + var_in { "uint16_t", "rename_threshold" }, + c_source [[ + ${this}->rename_threshold = ${rename_threshold}; +]], + }, + field "uint16_t" "rename_from_rewrite_threshold", + method "set_rename_from_rewrite_threshold" { + var_in { "uint16_t", "rename_from_rewrite_threshold" }, + c_source [[ + ${this}->rename_from_rewrite_threshold = ${rename_from_rewrite_threshold}; +]], + }, + field "uint16_t" "copy_threshold", + method "set_copy_threshold" { + var_in { "uint16_t", "copy_threshold" }, + c_source [[ + ${this}->copy_threshold = ${copy_threshold}; +]], + }, + field "uint16_t" "break_rewrite_threshold", + method "set_break_rewrite_threshold" { + var_in { "uint16_t", "break_rewrite_threshold" }, + c_source [[ + ${this}->break_rewrite_threshold = ${break_rewrite_threshold}; +]], + }, + field "size_t" "rename_limit", + method "set_rename_limit" { + var_in { "size_t", "rename_limit" }, + c_source [[ + ${this}->rename_limit = ${rename_limit}; +]], + }, +} diff --git a/src/diff_options.nobj.lua b/src/diff_options.nobj.lua new file mode 100644 index 0000000..d5ae48c --- /dev/null +++ b/src/diff_options.nobj.lua @@ -0,0 +1,160 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "DiffOptions" { + c_source [[ +typedef git_diff_options DiffOptions; +]], + constants { + VERSION = 1, + NORMAL = 0, + REVERSE = 1, + INCLUDE_IGNORED = 2, + RECURSE_IGNORED_DIRS = 4, + INCLUDE_UNTRACKED = 8, + RECURSE_UNTRACKED_DIRS = 16, + INCLUDE_UNMODIFIED = 32, + INCLUDE_TYPECHANGE = 64, + INCLUDE_TYPECHANGE_TREES = 128, + IGNORE_FILEMODE = 256, + IGNORE_SUBMODULES = 512, + IGNORE_CASE = 1024, + INCLUDE_CASECHANGE = 2048, + DISABLE_PATHSPEC_MATCH = 4096, + SKIP_BINARY_CHECK = 8192, + ENABLE_FAST_UNTRACKED_DIRS = 16384, + UPDATE_INDEX = 32768, + INCLUDE_UNREADABLE = 65536, + INCLUDE_UNREADABLE_AS_UNTRACKED = 131072, + INDENT_HEURISTIC = 262144, + IGNORE_BLANK_LINES = 524288, + FORCE_TEXT = 1048576, + FORCE_BINARY = 2097152, + IGNORE_WHITESPACE = 4194304, + IGNORE_WHITESPACE_CHANGE = 8388608, + IGNORE_WHITESPACE_EOL = 16777216, + SHOW_UNTRACKED_CONTENT = 33554432, + SHOW_UNMODIFIED = 67108864, + PATIENCE = 268435456, + MINIMAL = 536870912, + SHOW_BINARY = 1073741824, + SUBMODULE_IGNORE_UNSPECIFIED = -1, + SUBMODULE_IGNORE_NONE = 1, + SUBMODULE_IGNORE_UNTRACKED = 2, + SUBMODULE_IGNORE_DIRTY = 3, + SUBMODULE_IGNORE_ALL = 4, + }, + constructor "init" { + c_source [[ + ${this} = calloc(1, sizeof(DiffOptions)); + git_diff_options_init(${this}, GIT_DIFF_OPTIONS_VERSION); +]], + }, + destructor { + c_source [[ + if(${this}->old_prefix != NULL) { + free((void *)${this}->old_prefix); + ${this}->old_prefix = NULL; + } + if(${this}->new_prefix != NULL) { + free((void *)${this}->new_prefix); + ${this}->new_prefix = NULL; + } + free(${this}); +]] + }, + field "unsigned int" "version", + field "unsigned int" "flags", + method "set_flags" { + var_in { "unsigned int", "flags" }, + c_source [[ + ${this}->flags = ${flags}; +]], + }, + field "unsigned int" "ignore_submodules", + method "set_ignore_submodules" { + var_in { "unsigned int", "ignore_submodules" }, + c_source [[ + ${this}->ignore_submodules = ${ignore_submodules}; +]], + }, + method "pathspec" { + var_out { "StrArray *", "pathspec" }, + c_source [[ + ${pathspec} = &${this}->pathspec; +]], + }, + method "set_pathspec" { + var_in { "StrArray *", "pathspec" }, + c_source [[ + ${this}->pathspec.strings = ${pathspec}->strings; + ${this}->pathspec.count = ${pathspec}->count; +]], + }, + field "uint32_t" "context_lines", + method "set_context_lines" { + var_in { "uint32_t", "context_lines" }, + c_source [[ + ${this}->context_lines = ${context_lines}; +]], + }, + field "uint32_t" "interhunk_lines", + method "set_interhunk_lines" { + var_in { "uint32_t", "interhunk_lines" }, + c_source [[ + ${this}->interhunk_lines = ${interhunk_lines}; +]], + }, + field "unsigned int" "oid_type", + method "set_oid_type" { + var_in { "unsigned int", "oid_type" }, + c_source [[ + ${this}->oid_type = ${oid_type}; +]], + }, + field "uint16_t" "id_abbrev", + method "set_id_abbrev" { + var_in { "uint16_t", "id_abbrev" }, + c_source [[ + ${this}->id_abbrev = ${id_abbrev}; +]], + }, + field "int64_t" "max_size", + method "set_max_size" { + var_in { "int64_t", "max_size" }, + c_source [[ + ${this}->max_size = ${max_size}; +]], + }, + field "const char *" "old_prefix", + method "set_old_prefix" { + var_in { "const char *", "old_prefix" }, + c_source [[ + ${this}->old_prefix = ${old_prefix}; +]], + }, + field "const char *" "new_prefix", + method "set_new_prefix" { + var_in { "const char *", "new_prefix" }, + c_source [[ + ${this}->new_prefix = ${new_prefix}; +]], + }, +} diff --git a/src/diff_stat.nobj.lua b/src/diff_stat.nobj.lua new file mode 100644 index 0000000..214a6b2 --- /dev/null +++ b/src/diff_stat.nobj.lua @@ -0,0 +1,44 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- Permission is hereby granted, free of charge, to any person obtaining a copy +-- of this software and associated documentatsion files (the "Software"), to deal +-- in the Software without restriction, including without limitatsion 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. + +object "DiffStats" { + c_source [[ +typedef git_diff_stats DiffStats; +]], + constants { + NONE = 0, + FULL = 1, + SHORT = 2, + NUMBER = 4, + INCLUDE_SUMMARY = 8, + }, + constructor "get" { + c_call { "GitError", "err" } "git_diff_get_stats" { "DiffStats *", "&this>1", "Diff *", "diff" }, + }, + method "insertions" { + c_method_call { "size_t", "size" } "git_diff_stats_insertions" {}, + }, + method "deletions" { + c_method_call { "size_t", "size" } "git_diff_stats_deletions" {}, + }, + method "files_changed" { + c_method_call { "size_t", "size" } "git_diff_stats_files_changed" {}, + }, +} diff --git a/src/index_entry.nobj.lua b/src/index_entry.nobj.lua index 4fdb19b..3703e41 100644 --- a/src/index_entry.nobj.lua +++ b/src/index_entry.nobj.lua @@ -80,10 +80,22 @@ typedef git_index_entry IndexEntry; field "unsigned int" "dev", field "unsigned int" "ino", field "unsigned int" "mode", + method "set_mode" { + var_in{ "unsigned int", "mode" }, + c_source [[ + ${this}->mode = ${mode}; +]] + }, field "unsigned int" "uid", field "unsigned int" "gid", field "off_t" "file_size", field "OID" "id", + method "set_id" { + var_in{ "OID", "id" }, + c_source [[ + git_oid_cpy(&${this}->id, &${id}); +]] + }, field "unsigned int" "flags", field "unsigned int" "flags_extended", method "path" { diff --git a/src/object.nobj.lua b/src/object.nobj.lua index 36a7099..5a114fa 100644 --- a/src/object.nobj.lua +++ b/src/object.nobj.lua @@ -33,6 +33,9 @@ typedef git_object Object; GIT_OBJ_TAG = "Tag", }, }, + constructor "revparse_single" { + c_call { "GitError", "err" } "git_revparse_single" { "Object *", "&this>1", "Repository *", "repo", "const char *", "spec" } + }, destructor "free" { c_method_call "void" "git_object_free" {} }, diff --git a/src/repository.nobj.lua b/src/repository.nobj.lua index d3ba7c0..5138612 100644 --- a/src/repository.nobj.lua +++ b/src/repository.nobj.lua @@ -49,6 +49,9 @@ typedef git_repository Repository; method "head_detached" { c_method_call "bool" "git_repository_head_detached" {} }, + method "set_head_detached" { + c_method_call { "GitError", "err" } "git_repository_set_head_detached" { "OID *", "committish"} + }, method "head_unborn" { c_method_call "bool" "git_repository_head_unborn" {} }, @@ -88,5 +91,14 @@ typedef git_repository Repository; method "set_index" { c_method_call "void" "git_repository_set_index" { "Index *", "index"} }, + method "checkout_tree" { + c_method_call { "GitError", "err" } "git_checkout_tree" { "const Object *", "treeish", "const CheckoutOptions *", "opts"} + }, + method "checkout_head" { + c_method_call { "GitError", "err" } "git_checkout_head" { "const CheckoutOptions *", "opts"} + }, + method "checkout_index" { + c_method_call { "GitError", "err" } "git_checkout_index" { "Index *", "index", "const CheckoutOptions *", "opts"} + }, } diff --git a/src/status_entry.nobj.lua b/src/status_entry.nobj.lua new file mode 100644 index 0000000..3bc88f6 --- /dev/null +++ b/src/status_entry.nobj.lua @@ -0,0 +1,47 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "StatusEntry" { + c_source [[ +typedef git_status_entry StatusEntry; +]], + constants { + CURRENT = 0, + INDEX_NEW = 1, + INDEX_MODIFIED = 2, + INDEX_DELETED = 4, + INDEX_RENAMED = 8, + INDEX_TYPECHANGE = 16, + WT_NEW = 128, + WT_MODIFIED = 256, + WT_DELETED = 512, + WT_TYPECHANGE = 1024, + WT_RENAMED = 2048, + WT_UNREADABLE = 4096, + IGNORED = 16384, + CONFLICTED = 32768, + }, + constructor "byindex" { + c_call "StatusEntry *>1" "git_status_byindex" { "StatusList *", "statuslist", "size_t", "idx" }, + }, + field "unsigned int" "status", + field "DiffDelta *" "head_to_index", + field "DiffDelta *" "index_to_workdir", +} diff --git a/src/status_list.nobj.lua b/src/status_list.nobj.lua new file mode 100644 index 0000000..6dbc310 --- /dev/null +++ b/src/status_list.nobj.lua @@ -0,0 +1,34 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "StatusList" { + c_source [[ +typedef git_status_list StatusList; +]], + constructor "new" { + c_call { "GitError", "err" } "git_status_list_new" { "StatusList *", "&this>1", "Repository *", "repo", "const StatusOptions *", "opts" }, + }, + destructor { + c_method_call "void" "git_status_list_free" {} + }, + method "entrycount" { + c_method_call { "size_t", "count" } "git_status_list_entrycount" {}, + }, +} diff --git a/src/status_options.nobj.lua b/src/status_options.nobj.lua new file mode 100644 index 0000000..31ae774 --- /dev/null +++ b/src/status_options.nobj.lua @@ -0,0 +1,100 @@ +-- Copyright (c) 2010-2012 by Robert G. Jakabosky +-- +-- 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. + +object "StatusOptions" { + c_source [[ +typedef git_status_options StatusOptions; +]], + constants { + VERSION = 1, + SHOW_INDEX_AND_WORKDIR = 0, + SHOW_INDEX_ONLY = 1, + SHOW_WORKDIR_ONLY = 2, + INCLUDE_UNTRACKED = 1, + INCLUDE_IGNORED = 2, + INCLUDE_UNMODIFIED = 4, + EXCLUDE_SUBMODULES = 8, + RECURSE_UNTRACKED_DIRS = 16, + DISABLE_PATHSPEC_MATCH = 32, + RECURSE_IGNORED_DIRS = 64, + RENAMES_HEAD_TO_INDEX = 128, + RENAMES_INDEX_TO_WORKDIR = 256, + SORT_CASE_SENSITIVELY = 512, + SORT_CASE_INSENSITIVELY = 1024, + RENAMES_FROM_REWRITES = 2048, + NO_REFRESH = 4096, + UPDATE_INDEX = 8192, + INCLUDE_UNREADABLE = 16384, + INCLUDE_UNREADABLE_AS_UNTRACKED = 32768, + }, + constructor "init" { + c_source [[ + ${this} = calloc(1, sizeof(StatusOptions)); + git_status_options_init(${this}, GIT_STATUS_OPTIONS_VERSION); +]], + }, + destructor { + c_source [[ + free(${this}); +]] + }, + field "unsigned int" "version", + field "unsigned int" "show", + method "set_show" { + var_in { "unsigned int", "show" }, + c_source [[ + ${this}->show = ${show}; +]], + }, + field "unsigned int" "flags", + method "set_flags" { + var_in { "unsigned int", "flags" }, + c_source [[ + ${this}->flags = ${flags}; +]], + }, + method "pathspec" { + var_out { "StrArray *", "pathspec" }, + c_source [[ + ${pathspec} = &${this}->pathspec; +]], + }, + method "set_pathspec" { + var_in { "StrArray *", "pathspec" }, + c_source [[ + ${this}->pathspec.strings = ${pathspec}->strings; + ${this}->pathspec.count = ${pathspec}->count; +]], + }, + field "Tree *" "baseline", + method "set_baseline" { + var_in { "Tree *", "baseline" }, + c_source [[ + ${this}->baseline = ${baseline}; +]], + }, + field "uint16_t" "rename_threshold", + method "set_rename_threshold" { + var_in { "uint16_t", "rename_threshold" }, + c_source [[ + ${this}->rename_threshold = ${rename_threshold}; +]], + }, +} diff --git a/src/strarray.nobj.lua b/src/strarray.nobj.lua index f9e26c6..9cb3069 100644 --- a/src/strarray.nobj.lua +++ b/src/strarray.nobj.lua @@ -24,17 +24,18 @@ object "StrArray" { typedef git_strarray StrArray; ]], constructor "new" { + var_in{ "size_t", "n" }, c_source[[ StrArray array; - array.strings = NULL; - array.count = 0; + array.strings = (char **)calloc(${n}, sizeof(char *)); + array.count = ${n}; ${this} = &array; ]] }, destructor "free" { c_source[[ if(${this}->strings != 0) { - git_strarray_free(${this}); + git_strarray_dispose(${this}); ${this}->strings = NULL; } ]] @@ -47,6 +48,18 @@ typedef git_strarray StrArray; if(${n} < ${this}->count) { ${str} = ${this}->strings[${n}]; } +]], + }, + method "set_str" { + var_in{ "size_t", "n" }, + var_in{ "const char *", "str" }, + c_source[[ + if(${n} < ${this}->count) { + if(${this}->strings[${n}] != NULL) { + free(${this}->strings[${n}]); + } + ${this}->strings[${n}] = strdup(${str}); + } ]], }, method "get_array" { diff --git a/src/tree_entry.nobj.lua b/src/tree_entry.nobj.lua index 6f1e85d..4e5aff5 100644 --- a/src/tree_entry.nobj.lua +++ b/src/tree_entry.nobj.lua @@ -22,6 +22,12 @@ object "TreeEntry" { c_source [[ typedef git_tree_entry TreeEntry; ]], + constructor "bypath" { + c_call { "GitError", "err" } "git_tree_entry_bypath" { "const TreeEntry *", "&this>1", "const Tree *", "tree", "const char *", "path" } + }, + destructor "free" { + c_method_call "void" "git_tree_entry_free" {} + }, method "name" { c_method_call "const char *" "git_tree_entry_name" {} },