Skip to content

Commit

Permalink
Merge pull request #4 from Weyzu/0.25.1
Browse files Browse the repository at this point in the history
Update bindings for 0.25.1
  • Loading branch information
s-ludwig authored Jun 21, 2017
2 parents 4c71592 + 1f3ef74 commit 119caf9
Show file tree
Hide file tree
Showing 31 changed files with 619 additions and 199 deletions.
4 changes: 4 additions & 0 deletions source/deimos/git2/all.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module deimos.git2.all;

public
{
import deimos.git2.annotated_commit;
import deimos.git2.attr;
import deimos.git2.blame;
import deimos.git2.blob;
Expand Down Expand Up @@ -31,7 +32,9 @@ public
import deimos.git2.pack;
import deimos.git2.patch;
import deimos.git2.pathspec;
import deimos.git2.proxy;
import deimos.git2.push;
import deimos.git2.rebase;
import deimos.git2.refdb;
import deimos.git2.reflog;
import deimos.git2.refs;
Expand Down Expand Up @@ -62,4 +65,5 @@ public
import deimos.git2.sys.reflog;
import deimos.git2.sys.refs;
import deimos.git2.sys.repository;
import deimos.git2.sys.transport;
}
36 changes: 36 additions & 0 deletions source/deimos/git2/annotated_commit.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module deimos.git2.annotated_commit;

import deimos.git2.common;
import deimos.git2.oid;
import deimos.git2.repository;
import deimos.git2.types;

extern(C):

int git_annotated_commit_from_ref(
git_annotated_commit **out_,
git_repository *repo,
const(git_reference)* ref_);

int git_annotated_commit_from_fetchhead(
git_annotated_commit **out_,
git_repository* repo,
const(char)* branch_name,
const(char)* remote_url,
const(git_oid)* id);

int git_annotated_commit_lookup(
git_annotated_commit **out_,
git_repository *repo,
const(git_oid)* id);

int git_annotated_commit_from_revspec(
git_annotated_commit **out_,
git_repository* repo,
const(char)* revspec);

const(git_oid)* git_annotated_commit_id(
const(git_annotated_commit)* commit);

void git_annotated_commit_free(
git_annotated_commit* commit);
20 changes: 13 additions & 7 deletions source/deimos/git2/blame.d
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum git_blame_flag_t {
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
GIT_BLAME_FIRST_PARENT = (1<<4),
}

struct git_blame_options {
Expand All @@ -21,23 +22,28 @@ struct git_blame_options {
uint16_t min_match_characters;
git_oid newest_commit;
git_oid oldest_commit;
uint32_t min_line;
uint32_t max_line;
size_t min_line;
size_t max_line;
}

enum GIT_BLAME_OPTIONS_VERSION = 1;
enum git_blame_options GIT_BLAME_OPTIONS_INIT = {GIT_BLAME_OPTIONS_VERSION};

int git_blame_init_options(
git_blame_options *opts,
uint version_);


struct git_blame_hunk {
uint16_t lines_in_hunk;
size_t lines_in_hunk;

git_oid final_commit_id;
uint16_t final_start_line_number;
size_t final_start_line_number;
git_signature *final_signature;

git_oid orig_commit_id;
const(char) *orig_path;
uint16_t orig_start_line_number;
size_t orig_start_line_number;
git_signature *orig_signature;

byte boundary;
Expand All @@ -50,7 +56,7 @@ struct git_blame {

uint32_t git_blame_get_hunk_count(git_blame *blame);
const(git_blame_hunk)* git_blame_get_hunk_byindex(git_blame *blame, uint32_t index);
const(git_blame_hunk)* git_blame_get_hunk_byline(git_blame *blame, uint32_t lineno);
const(git_blame_hunk)* git_blame_get_hunk_byline(git_blame *blame, size_t lineno);
int git_blame_file(git_blame **out_, git_repository *repo, const(char)* path, git_blame_options *options);
int git_blame_buffer(git_blame **out_, git_blame *reference, const(char)* buffer, uint32_t buffer_len);
int git_blame_buffer(git_blame **out_, git_blame *reference, const(char)* buffer, size_t buffer_len);
void git_blame_free(git_blame *blame);
13 changes: 5 additions & 8 deletions source/deimos/git2/blob.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ int git_blob_create_fromdisk(git_oid *id, git_repository *repo, const(char)* pat

alias git_blob_chunk_cb = int function(char *content, size_t max_length, void *payload);

int git_blob_create_fromchunks(
git_oid *id,
git_repository *repo,
const(char)* hintpath,
git_blob_chunk_cb callback,
void *payload);
int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const(void)* buffer, size_t len);
int git_blob_is_binary(git_blob *blob);
int git_blob_create_frombuffer(git_oid *id, git_repository *repo, const(void)* buffer, size_t len);
int git_blob_is_binary(const(git_blob)* blob);
int git_blob_create_fromstream(git_writestream **out_, git_repository *repo, const(char)* hintpath);
int git_blob_create_fromstream_commit(git_oid *out_, git_writestream *_stream);
int git_blob_dup(git_blob **out_, git_blob *source);
27 changes: 18 additions & 9 deletions source/deimos/git2/branch.d
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module deimos.git2.branch;

import deimos.git2.buffer;
import deimos.git2.common;
import deimos.git2.oid;
import deimos.git2.types;
Expand All @@ -12,6 +13,14 @@ int git_branch_create(
const(char)* branch_name,
const(git_commit)* target,
int force);

int git_branch_create_from_annotated(
git_reference **ref_out,
git_repository* repository,
const(char)* branch_name,
const(git_annotated_commit)* commit,
int force);

int git_branch_delete(git_reference *branch);

struct git_branch_iterator {
Expand All @@ -32,21 +41,21 @@ int git_branch_lookup(
git_repository *repo,
const(char)* branch_name,
git_branch_t branch_type);
int git_branch_name(const(char)** out_,
git_reference *ref_);
int git_branch_name(
const(char)** out_,
const(git_reference)* ref_);
int git_branch_upstream(
git_reference **out_,
git_reference *branch);
const(git_reference)* branch);
int git_branch_set_upstream(git_reference *branch, const(char)* upstream_name);
int git_branch_upstream_name(
char *tracking_branch_name_out,
size_t buffer_size,
git_buf* out_,
git_repository *repo,
const(char)* canonical_branch_name);
const(char)* refname);
int git_branch_is_head(
git_reference *branch);
const(git_reference)* branch);
int git_branch_remote_name(
char *remote_name_out,
size_t buffer_size,
git_buf* out_,
git_repository *repo,
const(char)* canonical_branch_name);
int git_branch_upstream_remote(git_buf* buf, git_repository* repo, const(char)* refname);
2 changes: 2 additions & 0 deletions source/deimos/git2/buffer.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ struct git_buf {
void git_buf_free(git_buf *buffer);
int git_buf_grow(git_buf *buffer, size_t target_size);
int git_buf_set(git_buf *buffer, const(void)* data, size_t datalen);
int git_buf_is_binary(const(git_buf)* buf);
int git_buf_contains_nul(const(git_buf)* buf);
44 changes: 35 additions & 9 deletions source/deimos/git2/checkout.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ extern (C):
enum git_checkout_strategy_t {
GIT_CHECKOUT_NONE = 0,
GIT_CHECKOUT_SAFE = (1u << 0),
GIT_CHECKOUT_SAFE_CREATE = (1u << 1),
GIT_CHECKOUT_FORCE = (1u << 2),
GIT_CHECKOUT_FORCE = (1u << 1),
GIT_CHECKOUT_RECREATE_MISSING = (1u << 2),
GIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4),
GIT_CHECKOUT_REMOVE_UNTRACKED = (1u << 5),
GIT_CHECKOUT_REMOVE_IGNORED = (1u << 6),
Expand All @@ -24,6 +24,11 @@ enum git_checkout_strategy_t {
GIT_CHECKOUT_USE_THEIRS = (1u << 12),
GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = (1u << 13),
GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = (1u << 18),
GIT_CHECKOUT_DONT_OVERWRITE_IGNORED = (1u << 19),
GIT_CHECKOUT_CONFLICT_STYLE_MERGE = (1u << 20),
GIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21),
GIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22),
GIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
GIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16),
GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17),
}
Expand All @@ -41,6 +46,12 @@ enum git_checkout_notify_t {
}
mixin _ExportEnumMembers!git_checkout_notify_t;

struct git_checkout_perfdata {
size_t mkdir_calls;
size_t stat_calls;
size_t chmod_calls;
}

alias git_checkout_notify_cb = int function(
git_checkout_notify_t why,
const(char)* path,
Expand All @@ -49,14 +60,19 @@ alias git_checkout_notify_cb = int function(
const(git_diff_file)* workdir,
void *payload);

alias git_checkout_perfdata_cb = void function(
const(git_checkout_perfdata)* perfdata,
void *payload
);

alias git_checkout_progress_cb = void function(
const(char)* path,
size_t completed_steps,
size_t total_steps,
void *payload);

struct git_checkout_opts {
uint version_ = GIT_CHECKOUT_OPTS_VERSION;
struct git_checkout_options {
uint version_ = GIT_CHECKOUT_OPTIONS_VERSION;

uint checkout_strategy;

Expand All @@ -71,22 +87,32 @@ struct git_checkout_opts {
void *progress_payload;
git_strarray paths;
git_tree *baseline;
git_index *baseline_index;

const(char)* target_directory;

const(char)* ancestor_label;
const(char)* our_label;
const(char)* their_label;

git_checkout_perfdata_cb perfdata_cb;
void *perfdata_payload;
}

enum GIT_CHECKOUT_OPTS_VERSION = 1;
enum git_checkout_opts GIT_CHECKOUT_OPTS_INIT = { GIT_CHECKOUT_OPTS_VERSION };
enum GIT_CHECKOUT_OPTIONS_VERSION = 1;
enum git_checkout_options GIT_CHECKOUT_OPTIONS_INIT = { GIT_CHECKOUT_OPTIONS_VERSION };

int git_checkout_init_options(
git_checkout_options *opts,
uint version_);
int git_checkout_head(
git_repository *repo,
const(git_checkout_opts)* opts);
const(git_checkout_options)* opts);
int git_checkout_index(
git_repository *repo,
git_index *index,
const(git_checkout_opts)* opts);
const(git_checkout_options)* opts);
int git_checkout_tree(
git_repository *repo,
const(git_object)* treeish,
const(git_checkout_opts)* opts);
const(git_checkout_options)* opts);
55 changes: 45 additions & 10 deletions source/deimos/git2/clone.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,59 @@ import deimos.git2.types;

extern (C):


enum git_clone_local_t {
GIT_CLONE_LOCAL_AUTO,
GIT_CLONE_LOCAL,
GIT_CLONE_NO_LOCAL,
GIT_CLONE_LOCAL_NO_LINKS,
}
mixin _ExportEnumMembers!git_clone_local_t;

alias git_remote_create_cb = int function(
git_remote **out_,
git_repository *repo,
const(char)* name,
const(char)* url,
void *payload,
);
alias git_repository_create_cb = int function(
git_repository **out_,
const(char)* path,
int bare,
void *payload,
);

struct git_clone_options {
uint version_ = GIT_CLONE_OPTIONS_VERSION;

git_checkout_opts checkout_opts;
git_remote_callbacks remote_callbacks;
git_checkout_options checkout_opts;
git_fetch_options fetch_opts;

int bare;
int ignore_cert_errors;
const(char)* remote_name;
git_clone_local_t local;
const(char)* checkout_branch;

git_repository_create_cb repository_cb;
void *repository_cb_payload;
git_remote_create_cb remote_cb;
void *remote_cb_payload;
}

enum GIT_CLONE_OPTIONS_VERSION = 1;
enum git_clone_options GIT_CLONE_OPTIONS_INIT = { GIT_CLONE_OPTIONS_VERSION };
enum git_clone_options GIT_CLONE_OPTIONS_INIT = {
GIT_CLONE_OPTIONS_VERSION,
{ GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE },
GIT_FETCH_OPTIONS_INIT
};

int git_clone_init_options(
git_clone_options *opts,
uint version_,
);
int git_clone(
git_repository **out_,
const(char)* url,
const(char)* local_path,
const(git_clone_options)* options);
int git_clone_into(git_repository *repo, git_remote *remote, const(git_checkout_opts)* co_opts, const(char)* branch);
git_repository **out_,
const(char)* url,
const(char)* local_path,
const(git_clone_options)* options,
);
Loading

0 comments on commit 119caf9

Please sign in to comment.