History

frame for basic parsing (#450)

Sebastian Thiel committed 4 years ago

Commit b9a4bdc1 parent 5c823dc3 files · +51 −0Browse files

Showing the changes to git-refspec/src (2 of 3 files). Show all

Unified · Split

2 files
  1. git-refspec/src/lib.rs +5 −0
  2. git-refspec/src/parse.rs +18 −0
git-refspec/src/lib.rs+5−0
@@ -7,6 +7,8 @@ use bstr::{BStr, BString}; · 6 unmodified lines
77 /// The way to interpret a refspec.
88 #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
99 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,
1012 /// Even though according to normal rules a non-fastforward would be denied, override this and reset a ref forcefully in the destination.
1113 Force,
1214 /// 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
4042 dest: Option<BString>,
4143 }
4244
45+pub mod parse;
46+pub use parse::function::parse;
47+
4348 mod spec {
4449 use crate::{RefSpec, RefSpecRef};
4550
git-refspec/src/parse.rs+18−0
@@ -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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t