[PATCH] git-tar-tree: cleanup write_trailer()
[git/dscho.git] / rpull.c
blob8b3322fe0798d8d74c54817d020ff1478d4a25d4
1 #include "cache.h"
2 #include "commit.h"
3 #include "rsh.h"
4 #include "pull.h"
6 static int fd_in;
7 static int fd_out;
9 int fetch(unsigned char *sha1)
11 int ret;
12 write(fd_out, sha1, 20);
13 ret = write_sha1_from_fd(sha1, fd_in);
14 if (!ret)
15 pull_say("got %s\n", sha1_to_hex(sha1));
16 return ret;
19 int main(int argc, char **argv)
21 char *commit_id;
22 char *url;
23 int arg = 1;
25 while (arg < argc && argv[arg][0] == '-') {
26 if (argv[arg][1] == 't') {
27 get_tree = 1;
28 } else if (argv[arg][1] == 'c') {
29 get_history = 1;
30 } else if (argv[arg][1] == 'd') {
31 get_delta = 0;
32 } else if (argv[arg][1] == 'a') {
33 get_all = 1;
34 get_tree = 1;
35 get_history = 1;
36 } else if (argv[arg][1] == 'v') {
37 get_verbosely = 1;
39 arg++;
41 if (argc < arg + 2) {
42 usage("git-rpull [-c] [-t] [-a] [-v] [-d] commit-id url");
43 return 1;
45 commit_id = argv[arg];
46 url = argv[arg + 1];
48 if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
49 return 1;
51 if (pull(commit_id))
52 return 1;
54 return 0;