X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=Git2.vala;h=cc146292e3faa6bc49aa3ce80ef6f2782e7d27aa;hp=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391;hb=refs%2Fheads%2Fwip_alan_T5782_messing_around_with_libgit2glib;hpb=23677c544b81e2eb9744e8c21f3c3028338138a3 diff --git a/Git2.vala b/Git2.vala index e69de29b..cc146292 100644 --- a/Git2.vala +++ b/Git2.vala @@ -0,0 +1,61 @@ + + +void main() +{ + GLib.Log.set_handler(null, + GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING | GLib.LogLevelFlags.LEVEL_INFO, + (dom, lvl, msg) => { + + + // should we debug.. + + + print("%s\n", msg); + } + ); + + Git.Threads.init(); + var a = new GitLive.Repo("/home/alan/gitlive/web.Texon"); + a.fetchAll(); +} +namespace GitLive { + + public class Repo : Object + { + Git.Repository repo; + + public Repo (string path) + { + Git.Repository.open(out this.repo , path); + } + + public void push() + { + string_array remotes; + this.repo.get_remote_list(out remotes); + + foreach(var rem in remotes.strings) { + Git.Remote remote; + this.repo.get_remote(out remote, rem_name); + + + // get the remote. + git_remote* remote = NULL; + git_remote_lookup( &remote, repository, "origin" ); + + // connect to remote + git_remote_connect( remote, GIT_DIRECTION_PUSH ) + + // add a push refspec + git_remote_add_push( remote, "refs/heads/master:refs/heads/master" ); + + // configure options + git_push_options options; + git_push_init_options( &options, GIT_PUSH_OPTIONS_VERSION ); + + // do the push + git_remote_upload( remote, NULL, &options ); + + git_remote_free( remote ); + return true; + } \ No newline at end of file