Skip to content

Commit

Permalink
make bracket matching work better (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 13, 2022
1 parent fa0440f commit 97aa9ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions git-glob/src/wildmatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ pub(crate) mod function {
match next {
None => return AbortAll,
Some((_p_idx, mut p_ch)) => match p_ch {
BRACKET_CLOSE => break,
BACKSLASH => match p.next() {
Some((_, p_ch)) => {
if p_ch == t_ch {
Expand Down Expand Up @@ -213,11 +212,14 @@ pub(crate) mod function {
},
};
next = p.next();
if let Some((_, BRACKET_CLOSE)) = next {
break;
}
}
if matched == negated || mode.contains(Mode::SLASH_IS_LITERAL) && t_ch == SLASH {
return NoMatch;
}
todo!("bracket support post loop");
continue;
}
non_glob_ch => {
if non_glob_ch != t_ch {
Expand Down
4 changes: 2 additions & 2 deletions git-glob/tests/wildmatch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ fn corpus() {
}

#[test]
fn simple_double_star() {
let (_pattern, actual) = multi_match("test/**", "test/one/two");
fn empty_brackets() {
let (_pattern, actual) = multi_match("a[]]b", "a]b");
assert!(!actual.any_panicked());
assert_eq!(actual, expect_multi(1, 1, 1, 1));
}
Expand Down

0 comments on commit 97aa9ed

Please sign in to comment.