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 fetch_ref(char *ref
, unsigned char *sha1
)
47 int main(int argc
, char **argv
)
53 while (arg
< argc
&& argv
[arg
][0] == '-') {
54 if (argv
[arg
][1] == 't') {
56 } else if (argv
[arg
][1] == 'c') {
58 } else if (argv
[arg
][1] == 'd') {
60 } else if (!strcmp(argv
[arg
], "--recover")) {
62 } else if (argv
[arg
][1] == 'a') {
66 } else if (argv
[arg
][1] == 'v') {
72 usage("git-ssh-pull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url");
75 commit_id
= argv
[arg
];
78 if (setup_connection(&fd_in
, &fd_out
, "git-ssh-push", url
, arg
, argv
+ 1))