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 cmd_peek_remote(int argc
, const char **argv
, const char *prefix
)
32 for (i
= 1; i
< argc
; i
++) {
36 if (!prefixcmp(arg
, "--upload-pack=")) {
37 uploadpack
= arg
+ 14;
40 if (!prefixcmp(arg
, "--exec=")) {
44 if (!strcmp("--tags", arg
)) {
48 if (!strcmp("--heads", arg
)) {
52 if (!strcmp("--refs", arg
)) {
56 usage(peek_remote_usage
);
62 if (!dest
|| i
!= argc
- 1)
63 usage(peek_remote_usage
);
65 pid
= git_connect(fd
, dest
, uploadpack
, 0);
68 ret
= peek_remote(fd
, flags
);
71 ret
|= finish_connect(pid
);