11 #include <InterfaceKit.h>    64     git_repository* repo = NULL;
    65     git_remote* remote = NULL;
    66     git_reference *head = NULL;
    67     git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
    68     git_push_options options;
    69     git_remote_autotag_option_t tags;
    74     err = git_repository_open(&repo, p->
path);
    80     err = git_remote_lookup(&remote, repo, 
"origin");
    86     err = git_repository_head(&head, repo);
    90     ref_name = git_reference_name(head);
    91     sprintf(refspec, 
"%s:%s", ref_name, ref_name);
    93     err = git_push_init_options(&options, GIT_PUSH_OPTIONS_VERSION);
    96     memcpy(&options.callbacks, &callbacks, 
sizeof(git_remote_callbacks));
   102     array.strings = (
char**) malloc(
sizeof(
char*) * array.count);
   103     array.strings[0] = refspec;
   105     err = git_remote_push(remote, &array, &options);
   109     err = git_remote_update_tips(remote, NULL, 1, tags, NULL);
   113         const git_error* er = giterr_last();
   114         printf(
"Error %d : %s\n", er->klass, er->message);
   116         BString buffer(
"Error : %s");
   117         buffer.ReplaceFirst(
"%s", er->message);
   118         BAlert *alert = 
new BAlert(
"", buffer.String(), 
"Cancel", 
   119                 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
   124     git_reference_free(head);
   125     git_remote_disconnect(remote);
   126     git_remote_free(remote);
   127     git_repository_free(repo);
   128     git_libgit2_shutdown();
 
Parameters to pass to push thread. 
Header file of Push command. 
virtual void Quit()
The function to Quit the window. 
virtual TrackGitWindow * GetWindow()
This returns pointer to the Push window. 
BString fRepo
The repository path where Push option is selected. 
int cred_acquire_cb(git_cred **out, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload)
This functions gets username and password from the user in case credentials are required. 
void * DoPushThread(void *arg)
This does git push on given repository. 
void SetText(const char *)
This function sets texts of the textview within window. 
Push(BString)
Push command constructor. 
virtual void Execute()
This is where actual calls to libgit2 will go. 
static pthread_t DoPush(PushWindow *, const char *)
This spawns thread to perform push over given repo. 
The TrackGit Window class. 
TrackGitWindow * fPushWindow
Push Window.