git_policy_cli/push/manual_push_cause.rs
1//! What:
2//! Why a manual push's scope could not be established, as a cause the hint is chosen by.
3//! Why:
4//! Every such failure stops the push with a `content-unavailable` engine failure, and that one code covers causes the
5//! person answers differently: a remote that moved is retried, a remote that could not be read is checked for network and
6//! credentials, and output the wrapper cannot read is a defect to report. A hint chosen by the code alone named missing
7//! content for all of them, which was true for one. The cause travels with the failure so the hint is chosen by it,
8//! never by matching the message text.
9//!
10//! In TS you'd write (pseudocode):
11//! ```ts
12//! type ManualPushCause = 'content-missing' | 'remote-moved' | 'remote-unreachable' | 'git-not-started' | 'git-silent' | 'unexpected-output' | 'unsupported-object' | 'self-explained';
13//! ```
14
15/// What:
16/// The cause of a manual-push discovery failure.
17/// Why:
18/// Each variant names what the person can do, because that is what separates the hints.
19///
20/// In TS you'd write (pseudocode):
21/// ```ts
22/// type ManualPushCause = 'content-missing' | 'remote-moved';
23/// ```
24#[derive(Clone, Copy, Debug, Eq, PartialEq)]
25pub enum ManualPushCause {
26 /// A Git read of the local repository failed for lack of an object, a ref or history: the content is not in this clone.
27 ContentMissing,
28 /// A destination ref changed between Git's dry run and the wrapper's confirmation: nothing is wrong, run it again.
29 RemoteMoved,
30 /// The remote's refs could not be read: network, address or credentials.
31 RemoteUnreachable,
32 /// Git could not be started for the check, so the Git the wrapper runs is missing or not executable.
33 GitNotStarted,
34 /// Git ended the check by a signal or with a failure status and no message, so there is nothing of Git's to relay.
35 GitSilent,
36 /// Git answered in a form the wrapper does not read: a defect of the wrapper, not of the repository.
37 UnexpectedOutput,
38 /// The push names an object of a kind the manual-push policies do not read (not a commit).
39 UnsupportedObject,
40 /// The message already says what to do (a deadline with its setting, a repository that cannot be located); no hint is added.
41 SelfExplained,
42}