5 static const char peek_remote_usage
[] =
6 "git-peek-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
7 static const char *uploadpack
= "git-upload-pack";
9 static int peek_remote(int fd
[2], unsigned flags
)
13 get_remote_heads(fd
[0], &ref
, 0, NULL
, flags
);
17 printf("%s %s\n", sha1_to_hex(ref
->old_sha1
), ref
->name
);
23 int main(int argc
, char **argv
)
32 setup_git_directory_gently(&nongit
);
34 for (i
= 1; i
< argc
; i
++) {
38 if (!strncmp("--upload-pack=", arg
, 14)) {
39 uploadpack
= arg
+ 14;
42 if (!strncmp("--exec=", arg
, 7)) {
46 if (!strcmp("--tags", arg
)) {
50 if (!strcmp("--heads", arg
)) {
54 if (!strcmp("--refs", arg
)) {
58 usage(peek_remote_usage
);
64 if (!dest
|| i
!= argc
- 1)
65 usage(peek_remote_usage
);
67 pid
= git_connect(fd
, dest
, uploadpack
);
70 ret
= peek_remote(fd
, flags
);
73 ret
|= finish_connect(pid
);