GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — libgit2/examples/push.c at main · libgit2/libgit2 Expand file tree/ Copy pathpush.cMore file actions 61 lines (52 loc) · 1.66 KB / Copy pathpush.cFile metadata and controls61 lines (52 loc) · 1.66 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 /* * libgit2 "push" example - shows how to push to remote * * Written by the libgit2 contributors * * To the extent possible under law, the author(s) have dedicated all copyright * and related and neighboring rights to this software to the public domain * worldwide. This software is distributed without any warranty. * * You should have received a copy of the CC0 Public Domain Dedication along * with this software. If not, see * <http://creativecommons.org/publicdomain/zero/1.0/>. */ #include "common.h" /** * This example demonstrates the libgit2 push API to roughly * simulate `git push`. * * This does not have: * * - Robust error handling * - Any of the `git push` options * * This does have: * * - Example of push to origin/master * */ /** Entry point for this command */ int lg2_push(git_repository *repo, int argc, char **argv) { git_push_options options; git_remote_callbacks callbacks; git_remote* remote = NULL; char *refspec = "refs/heads/master"; const git_strarray refspecs = { &refspec, 1 }; /* Validate args */ if (argc > 1) { printf ("USAGE: %s\n\nsorry, no arguments supported yet\n", argv[0]); return -1; } check_lg2(git_remote_lookup(&remote, repo, "origin" ), "Unable to lookup remote", NULL); check_lg2(git_remote_init_callbacks(&callbacks, GIT_REMOTE_CALLBACKS_VERSION), "Error initializing remote callbacks", NULL); callbacks.credentials = cred_acquire_cb; check_lg2(git_push_options_init(&options, GIT_PUSH_OPTIONS_VERSION ), "Error initializing push", NULL); options.callbacks = callbacks; check_lg2(git_remote_push(remote, &refspecs, &options), "Error pushing", NULL); printf("pushed\n"); return 0; } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |