rpull.con commit [PATCH 1/2] Test suite fixup. (886856a)
   1#include <fcntl.h>
   2#include <unistd.h>
   3#include <string.h>
   4#include <stdlib.h>
   5#include "cache.h"
   6#include "commit.h"
   7#include <errno.h>
   8#include <stdio.h>
   9#include "rsh.h"
  10#include "pull.h"
  11
  12static int fd_in;
  13static int fd_out;
  14
  15int fetch(unsigned char *sha1)
  16{
  17        int ret;
  18        write(fd_out, sha1, 20);
  19        ret = write_sha1_from_fd(sha1, fd_in);
  20        if (!ret)
  21                pull_say("got %s\n", sha1_to_hex(sha1));
  22        return ret;
  23}
  24
  25int main(int argc, char **argv)
  26{
  27        char *commit_id;
  28        char *url;
  29        int arg = 1;
  30
  31        while (arg < argc && argv[arg][0] == '-') {
  32                if (argv[arg][1] == 't') {
  33                        get_tree = 1;
  34                } else if (argv[arg][1] == 'c') {
  35                        get_history = 1;
  36                } else if (argv[arg][1] == 'a') {
  37                        get_all = 1;
  38                        get_tree = 1;
  39                        get_history = 1;
  40                } else if (argv[arg][1] == 'v') {
  41                        get_verbosely = 1;
  42                }
  43                arg++;
  44        }
  45        if (argc < arg + 2) {
  46                usage("git-rpull [-c] [-t] [-a] [-v] commit-id url");
  47                return 1;
  48        }
  49        commit_id = argv[arg];
  50        url = argv[arg + 1];
  51
  52        if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
  53                return 1;
  54
  55        if (pull(commit_id))
  56                return 1;
  57
  58        return 0;
  59}