6 static const char peek_remote_usage
[] =
7 "git-peek-remote [--upload-pack=<git-upload-pack>] [<host>:]<directory>";
9 int cmd_peek_remote(int argc
, const char **argv
, const char *prefix
)
12 const char *dest
= NULL
;
15 const char *uploadpack
= NULL
;
17 struct transport
*transport
;
18 const struct ref
*ref
;
20 setup_git_directory_gently(&nongit
);
22 for (i
= 1; i
< argc
; i
++) {
23 const char *arg
= argv
[i
];
26 if (!prefixcmp(arg
, "--upload-pack=")) {
27 uploadpack
= arg
+ 14;
30 if (!prefixcmp(arg
, "--exec=")) {
34 if (!strcmp("--tags", arg
)) {
38 if (!strcmp("--heads", arg
)) {
42 if (!strcmp("--refs", arg
)) {
46 usage(peek_remote_usage
);
52 if (!dest
|| i
!= argc
- 1)
53 usage(peek_remote_usage
);
55 transport
= transport_get(NULL
, dest
);
56 if (uploadpack
!= NULL
)
57 transport_set_option(transport
, TRANS_OPT_UPLOADPACK
, uploadpack
);
59 ref
= transport_get_remote_refs(transport
);
65 if (check_ref_type(ref
, flags
))
66 printf("%s %s\n", sha1_to_hex(ref
->old_sha1
), ref
->name
);