[PATCH] Be careful with symlinks when detecting renames and copies.
[alt-git.git] / rpull.c
blob36e49f799a6ac300a00f8d09d9dc9e6636b3d8e0
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] == 'a') {
31 get_all = 1;
32 get_tree = 1;
33 get_history = 1;
34 } else if (argv[arg][1] == 'v') {
35 get_verbosely = 1;
37 arg++;
39 if (argc < arg + 2) {
40 usage("git-rpull [-c] [-t] [-a] [-v] commit-id url");
41 return 1;
43 commit_id = argv[arg];
44 url = argv[arg + 1];
46 if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
47 return 1;
49 if (pull(commit_id))
50 return 1;
52 return 0;