9 static unsigned char remote_version
= 0;
10 static unsigned char local_version
= 1;
12 int fetch(unsigned char *sha1
)
17 if (has_sha1_file(sha1
))
19 write(fd_out
, &type
, 1);
20 write(fd_out
, sha1
, 20);
21 if (read(fd_in
, &remote
, 1) < 1)
25 ret
= write_sha1_from_fd(sha1
, fd_in
);
27 pull_say("got %s\n", sha1_to_hex(sha1
));
34 write(fd_out
, &type
, 1);
35 write(fd_out
, &local_version
, 1);
36 if (read(fd_in
, &remote_version
, 1) < 1) {
37 return error("Couldn't read version from remote end");
42 int main(int argc
, char **argv
)
48 while (arg
< argc
&& argv
[arg
][0] == '-') {
49 if (argv
[arg
][1] == 't') {
51 } else if (argv
[arg
][1] == 'c') {
53 } else if (argv
[arg
][1] == 'd') {
55 } else if (argv
[arg
][1] == 'a') {
59 } else if (argv
[arg
][1] == 'v') {
65 usage("git-rpull [-c] [-t] [-a] [-v] [-d] commit-id url");
68 commit_id
= argv
[arg
];
71 if (setup_connection(&fd_in
, &fd_out
, "git-rpush", url
, arg
, argv
+ 1))