pub enum CommitIntent {
Create,
Amend,
Reword,
Augment {
target: String,
},
MergeEdit {
branch: String,
},
RewordCommit {
target: String,
},
}Expand description
MG.42-E1: what the compose buffer is FOR.
Replaces an amend: bool that was derived by sniffing the buffer
name. A bool cannot express a third intent, and the sniff coupled a
buffer’s name to its behaviour — rename the buffer and the
operation silently changes. The name still selects the intent, but
it does so once, explicitly, at open.
Variants§
Create
A new commit from what is staged.
Amend
Replace the last commit, sweeping in anything staged.
Reword
Replace the last commit’s MESSAGE only, leaving the index
alone. Distinct from Amend precisely because a reword that
quietly absorbed staged changes would be a content change the
user never asked for.
Augment
Record a squash! marker for target, carrying the note the
user writes in the buffer. Magit’s A.
MergeEdit
Complete a merge of branch with an authored message. Magit’s
merge e.
RewordCommit
MG.43c: reword a commit that is NOT HEAD, via an interactive
rebase. Magit’s rebase w.
Distinct from Self::Reword, which amends HEAD directly. A
commit further back cannot be amended, so this replays history
with that commit’s todo verb set to reword and hands git the
message through GIT_EDITOR.
Implementations§
Source§impl CommitIntent
impl CommitIntent
Sourcepub fn from_buffer_name(name: &str) -> Self
pub fn from_buffer_name(name: &str) -> Self
Map a compose buffer’s name to its intent. Kept in ONE place so the mapping is auditable.
MR.3: read through the shared name grammar
(*magit:<view>[:<repo>[:<rest>]]*) rather than by substring.
The substring form it replaces (name.contains("reword")) was
fine while names held only a view word; with a repository in the
name, a checkout called amend or reword would have selected
the wrong operation on every commit buffer in it. Structured
parsing makes that unrepresentable rather than unlikely.
A name that does not parse at all falls to Create, which is
what an unrecognised compose buffer did before.
Sourcepub fn augment_buffer_name(repo: &str, target: &str) -> String
pub fn augment_buffer_name(repo: &str, target: &str) -> String
The buffer name that selects this intent, for the repository
labelled repo (empty outside one).
pub fn merge_edit_buffer_name(repo: &str, branch: &str) -> String
pub fn reword_commit_buffer_name(repo: &str, target: &str) -> String
Sourcepub fn seeds_prior_message(&self) -> bool
pub fn seeds_prior_message(&self) -> bool
Does the buffer open pre-filled with the previous message?
Sourcepub fn seed_source(&self) -> Option<&str>
pub fn seed_source(&self) -> Option<&str>
The commit whose message seeds the buffer, when it is not HEAD.
Trait Implementations§
Source§impl Clone for CommitIntent
impl Clone for CommitIntent
Source§fn clone(&self) -> CommitIntent
fn clone(&self) -> CommitIntent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CommitIntent
impl Debug for CommitIntent
impl Eq for CommitIntent
Source§impl PartialEq for CommitIntent
impl PartialEq for CommitIntent
impl StructuralPartialEq for CommitIntent
Auto Trait Implementations§
impl Freeze for CommitIntent
impl RefUnwindSafe for CommitIntent
impl Send for CommitIntent
impl Sync for CommitIntent
impl Unpin for CommitIntent
impl UnsafeUnpin for CommitIntent
impl UnwindSafe for CommitIntent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.§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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more