History

refactor

Sebastian Thiel committed 4 years ago

Commit 162f9a01 parent 0bed9382 files · +183 −179Browse files

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

Unified · Split

git-pathspec/src/parse.rs+7−11
@@ -7,18 +7,14 @@ use crate::{MagicSignature, Pattern, SearchMode}; · 6 unmodified lines
77 pub enum Error {
88 #[error("Empty string is not a valid pathspec")]
99 EmptyString,
10−
11− #[error("Found \"{}\", which is not a valid keyword", found_keyword)]
10+ #[error("Found {:?}, which is not a valid keyword", found_keyword)]
1211 InvalidKeyword { found_keyword: BString },
13−
14− #[error("Missing ')' at the end of pathspec magic in '{}'", pathspec)]
12+ #[error("Missing ')' at the end of pathspec magic in {:?}", pathspec)]
1513 MissingClosingParenthesis { pathspec: BString },
16−
17− #[error("Attribute has non-ascii characters or starts with '-': {}", attribute)]
14+ #[error("Attribute has non-ascii characters or starts with '-': {:?}", attribute)]
1815 InvalidAttribute { attribute: BString },
19−
20− #[error("'literal' and 'globl' keywords can not be used together in the same pathspec")]
21− IncompatibleSearchmodes,
16+ #[error("'literal' and 'glob' keywords cannot be used together in the same pathspec")]
17+ IncompatibleSearchModes,
2218 }
2319
2420 impl Pattern {
@@ -94,11 +90,11 @@ fn parse_keywords(input: &[u8]) -> Result<(MagicSignature, SearchMode, Vec<(BStr · 69 unmodified lines
9490 b"attr" => signature |= MagicSignature::ATTR,
9591 b"literal" => match searchmode {
9692 SearchMode::Default => searchmode = SearchMode::Literal,
97− _ => return Err(Error::IncompatibleSearchmodes),
93+ _ => return Err(Error::IncompatibleSearchModes),
9894 },
9995 b"glob" => match searchmode {
10096 SearchMode::Default => searchmode = SearchMode::Glob,
101− _ => return Err(Error::IncompatibleSearchmodes),
97+ _ => return Err(Error::IncompatibleSearchModes),
10298 },
10399 s => {
104100 if let Some(attrs) = s.strip_prefix(b"attr:") {

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