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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Receive-pack protocol handler (server side of push).
//!
//! Accepts pushes over smart HTTP by calling [`grit_lib::remote::serve::receive_pack`]
//! in-process.
use Read;
use Path;
use RepositoryOptions;
use crate::;
/// Run receive-pack ref advertisement (for `GET /info/refs?service=git-receive-pack`).
///
/// Returns the raw pkt-line advertisement bytes.
///
/// # Parameters
///
/// - `repository_options`: environment used to load global/system config (hide refs,
/// receive policy).
///
/// # Errors
///
/// Fails when `repo_path` is not a repository or advertisement generation fails.
/// Run a stateless receive-pack RPC exchange (for `POST /git-receive-pack`) on a
/// request body that is already in memory.
///
/// Takes the request body (pkt-line commands + pack data) and returns
/// the response (report-status). Prefer [`stateless_rpc_from_reader`] for HTTP
/// bodies, which can be as large as the pushed pack.
///
/// # Errors
///
/// Fails when the repository cannot be opened or the push is rejected.
/// Run a stateless receive-pack RPC exchange, reading the request body from a
/// stream.
///
/// The pushed pack is consumed from `request_body` as it arrives, so the caller
/// never has to hold the whole HTTP body in memory. The only size limit is the
/// repository's `receive.maxInputSize`, as with `git http-backend`.
///
/// # Parameters
///
/// - `repo_path`: the repository receiving the push.
/// - `request_body`: the decoded request body (pkt-line commands, then the pack).
/// - `repository_options`: environment used to load global/system config (hide refs,
/// receive policy).
///
/// # Returns
///
/// The response body (report-status, sideband-framed when the client asked for it).
///
/// # Errors
///
/// Fails when the repository cannot be opened, the command list is malformed, or
/// reading the request stream fails before the commands are parsed. A pack that
/// cannot be read or stored is reported to the client as an unpack error instead.