Skip to content

Commit 923c165

Browse files
committed
transport: add capabilities query function
1 parent b523776 commit 923c165

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

include/git2/sys/transport.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ struct git_transport {
4646
git_transport *transport,
4747
const git_remote_connect_options *connect_opts);
4848

49+
/**
50+
* Gets the capabilities for this remote repository.
51+
*
52+
* This function may be called after a successful call to
53+
* `connect()`.
54+
*/
55+
int GIT_CALLBACK(capabilities)(
56+
unsigned int *capabilities,
57+
git_transport *transport);
58+
4959
/**
5060
* Get the list of available references in the remote repository.
5161
*

src/transports/local.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,14 @@ static int local_set_connect_opts(
256256
return git_remote_connect_options_normalize(&t->connect_opts, t->owner->repo, connect_opts);
257257
}
258258

259+
static int local_capabilities(unsigned int *capabilities, git_transport *transport)
260+
{
261+
GIT_UNUSED(transport);
262+
263+
*capabilities = 0;
264+
return 0;
265+
}
266+
259267
static int local_ls(const git_remote_head ***out, size_t *size, git_transport *transport)
260268
{
261269
transport_local *t = (transport_local *)transport;
@@ -721,6 +729,7 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
721729
t->parent.version = GIT_TRANSPORT_VERSION;
722730
t->parent.connect = local_connect;
723731
t->parent.set_connect_opts = local_set_connect_opts;
732+
t->parent.capabilities = local_capabilities;
724733
t->parent.negotiate_fetch = local_negotiate_fetch;
725734
t->parent.download_pack = local_download_pack;
726735
t->parent.push = local_push;

src/transports/smart.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ static int git_smart__set_connect_opts(
226226
return git_remote_connect_options_normalize(&t->connect_opts, t->owner->repo, opts);
227227
}
228228

229+
static int git_smart__capabilities(unsigned int *capabilities, git_transport *transport)
230+
{
231+
GIT_UNUSED(transport);
232+
233+
*capabilities = 0;
234+
return 0;
235+
}
236+
229237
static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport)
230238
{
231239
transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
@@ -423,6 +431,7 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
423431
t->parent.version = GIT_TRANSPORT_VERSION;
424432
t->parent.connect = git_smart__connect;
425433
t->parent.set_connect_opts = git_smart__set_connect_opts;
434+
t->parent.capabilities = git_smart__capabilities;
426435
t->parent.close = git_smart__close;
427436
t->parent.free = git_smart__free;
428437
t->parent.negotiate_fetch = git_smart__negotiate_fetch;

0 commit comments

Comments
 (0)