Showing the changes to git-refspec/src (2 of 3 files). Show all
Unified · Split
| @@ -7,6 +7,8 @@ use bstr::{BStr, BString}; · 6 unmodified lines | ||
| 7 | 7 | /// The way to interpret a refspec. |
| 8 | 8 | #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] |
| 9 | 9 | pub enum Mode { |
| 10 | + /// Apply standard rules for refspecs which are including refs with specific rules related to allowing fast forwards of destinations. | |
| 11 | + Normal, | |
| 10 | 12 | /// Even though according to normal rules a non-fastforward would be denied, override this and reset a ref forcefully in the destination. |
| 11 | 13 | Force, |
| 12 | 14 | /// Instead of considering matching refs included, we consider them excluded. This applies only to the source side of a refspec. |
| @@ -40,6 +42,9 @@ pub struct RefSpec { · 27 unmodified lines | ||
| 40 | 42 | dest: Option<BString>, |
| 41 | 43 | } |
| 42 | 44 | |
| 45 | +pub mod parse; | |
| 46 | +pub use parse::function::parse; | |
| 47 | + | |
| 43 | 48 | mod spec { |
| 44 | 49 | use crate::{RefSpec, RefSpecRef}; |
| 45 | 50 | |
| @@ -0,0 +1,18 @@ | ||
| 1 | +#[derive(Debug, thiserror::Error)] | |
| 2 | +pub enum Error { | |
| 3 | + #[error("Empty refspecs are invalid")] | |
| 4 | + Empty, | |
| 5 | + #[error("Negative refspecs cannot have destinations as they exclude sources")] | |
| 6 | + NegativeWithDestination, | |
| 7 | +} | |
| 8 | + | |
| 9 | +pub(crate) mod function { | |
| 10 | + use crate::parse::Error; | |
| 11 | + use crate::{Operation, RefSpecRef}; | |
| 12 | + use bstr::BStr; | |
| 13 | + | |
| 14 | + /// Parse `spec` for use in `operation` and return it if it is valid. | |
| 15 | + pub fn parse(mut _spec: &BStr, _operation: Operation) -> Result<RefSpecRef<'_>, Error> { | |
| 16 | + todo!() | |
| 17 | + } | |
| 18 | +} | |