5f8e42b84d4a499067f91cfd59e1a333eb8fd2f7
[gitlive] / Git2.vala
1
2
3 void main()
4 {
5          GLib.Log.set_handler(null, 
6             GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING | GLib.LogLevelFlags.LEVEL_INFO, 
7             (dom, lvl, msg) => {
8                                         
9                                         
10                // should we debug..
11                                         
12                         
13                print("%s\n", msg);
14             }
15          ); 
16
17         Git.Threads.init();
18         var a = new GitLive.Repo("/home/alan/gitlive/web.Texon");
19         a.fetchAll();
20 }
21 namespace  GitLive {
22
23         public class Repo : Object 
24         {
25                 Git.Repository repo;
26                 
27                 public Repo (string path)
28                 {
29                         Git.Repository.open(this.repo , path);
30                 }
31                 
32                 
33                 
34
35
36 bool push(git_repository *repository) 
37  {
38      
39      git_repository* repository;
40      // get the remote.
41      git_remote* remote = NULL;
42      git_remote_lookup( &remote, repository, "origin" );
43
44      // connect to remote
45      git_remote_connect( remote, GIT_DIRECTION_PUSH )
46
47      // add a push refspec
48      git_remote_add_push( remote, "refs/heads/master:refs/heads/master" );
49
50      // configure options
51      git_push_options options;
52      git_push_init_options( &options, GIT_PUSH_OPTIONS_VERSION );
53
54      // do the push
55      git_remote_upload( remote, NULL, &options );
56
57      git_remote_free( remote );
58      return true; 
59  }