-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathlibgit2_internals.cpp
More file actions
66 lines (60 loc) · 1.73 KB
/
libgit2_internals.cpp
File metadata and controls
66 lines (60 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#ifdef EMSCRIPTEN
# include "libgit2_internals.hpp"
// http method and service.
std::string name_for_method(git_http_method method)
{
switch (method)
{
case GIT_HTTP_METHOD_GET:
return "GET";
case GIT_HTTP_METHOD_POST:
return "POST";
case GIT_HTTP_METHOD_CONNECT:
return "CONNECT";
}
return "";
}
std::optional<http_service> select_service(git_smart_service_t action)
{
switch (action)
{
case GIT_SERVICE_UPLOADPACK_LS:
return http_service{
GIT_HTTP_METHOD_GET,
"/info/refs?service=git-upload-pack",
nullptr,
"application/x-git-upload-pack-advertisement",
1,
0
};
case GIT_SERVICE_UPLOADPACK:
return http_service{
GIT_HTTP_METHOD_POST,
"/git-upload-pack",
"application/x-git-upload-pack-request",
"application/x-git-upload-pack-result",
0,
0
};
case GIT_SERVICE_RECEIVEPACK_LS:
return http_service{
GIT_HTTP_METHOD_GET,
"/info/refs?service=git-receive-pack",
nullptr,
"application/x-git-receive-pack-advertisement",
1,
0
};
case GIT_SERVICE_RECEIVEPACK:
return http_service{
GIT_HTTP_METHOD_POST,
"/git-receive-pack",
"application/x-git-receive-pack-request",
"application/x-git-receive-pack-result",
0,
1
};
}
return std::nullopt;
}
#endif // EMSCRIPTEN