pub enum HooksPath {
NotConfigured,
Own {
path: String,
},
Set {
path: String,
enabled: Vec<String>,
},
Shared {
path: String,
},
Untracked {
missing: String,
runs: String,
},
Failed {
message: String,
},
}Expand description
What became of the hooks directory of a worktree that was just created, found or moved.
It travels in the JSON of worktree create, ensure, migrate and repair, tagged by
outcome, so a reader branches on one word rather than parsing the line:
use majordomus_cli::worktree::HooksPath;
let set = HooksPath::Set {
path: "/r-wt/fix/x/.githooks".into(),
enabled: vec![],
};
let json = serde_json::to_value(&set).unwrap();
assert_eq!(json["outcome"], "set");
assert_eq!(json["path"], "/r-wt/fix/x/.githooks");
let back: HooksPath = serde_json::from_value(json).unwrap();
assert_eq!(back, set);Variants§
NotConfigured
The repository’s configuration sets no core.hooksPath: git’s own hooks directory
in the common directory (or a value of the user’s) serves every worktree, and there
is no tracked directory to follow.
Own
Git already resolves this worktree’s hooks to its own directory; nothing was set.
Set
This worktree’s core.hooksPath was set, per worktree, to its own directory.
Fields
The hooks directory is outside the primary checkout — one directory shared on purpose — and every worktree runs it; nothing was set.
Untracked
The primary checkout’s hooks directory has no counterpart in this worktree’s tree, so the worktree keeps running the primary’s: pointing it at a directory that does not exist would switch its hooks off.
Fields
Failed
Git was asked and refused, or could not be run; the message is its own.
Implementations§
Source§impl HooksPath
impl HooksPath
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
One line for a person, after the path the worktree is at.
use majordomus_cli::worktree::HooksPath;
let set = HooksPath::Set {
path: "/r-wt/fix/x/.githooks".into(),
enabled: vec!["extensions.worktreeConfig=true".into()],
};
assert_eq!(
set.describe(),
"hooks /r-wt/fix/x/.githooks, its own (git config --worktree core.hooksPath; \
enabled extensions.worktreeConfig=true)"
);
assert!(HooksPath::NotConfigured.describe().contains("no core.hooksPath"));Trait Implementations§
Source§impl<'de> Deserialize<'de> for HooksPath
impl<'de> Deserialize<'de> for HooksPath
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for HooksPath
Source§impl JsonSchema for HooksPath
impl JsonSchema for HooksPath
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for HooksPath
Auto Trait Implementations§
impl Freeze for HooksPath
impl RefUnwindSafe for HooksPath
impl Send for HooksPath
impl Sync for HooksPath
impl Unpin for HooksPath
impl UnsafeUnpin for HooksPath
impl UnwindSafe for HooksPath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.