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 (!strcmp(argv[arg], "--recover")) {
57 } else if (argv[arg][1] == 'a') {
61 } else if (argv[arg][1] == 'v') {
67 usage("git-ssh-pull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url");
70 commit_id = argv[arg];
73 if (setup_connection(&fd_in, &fd_out, "git-ssh-push", url, arg, argv + 1))