| static const char peek_remote_usage[] = |
| "git-peek-remote [--exec=upload-pack] [host:]directory"; |
| static const char *exec = "git-upload-pack"; |
| static int peek_remote(int fd[2], unsigned flags) |
| get_remote_heads(fd[0], &ref, 0, NULL, flags); |
| printf("%s %s\n", sha1_to_hex(ref->old_sha1), ref->name); |
| int main(int argc, char **argv) |
| setup_git_directory_gently(&nongit); |
| for (i = 1; i < argc; i++) { |
| if (!strncmp("--exec=", arg, 7)) { |
| if (!strcmp("--tags", arg)) { |
| if (!strcmp("--heads", arg)) { |
| if (!strcmp("--refs", arg)) { |
| usage(peek_remote_usage); |
| if (!dest || i != argc - 1) |
| usage(peek_remote_usage); |
| pid = git_connect(fd, dest, exec); |
| ret = peek_remote(fd, flags); |
| ret |= finish_connect(pid); |