Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- (#512) Fixed so that the setting for `--color` is now respected.
- (#512) Fixed so that you can pass `--color` anywhere in the command-line, not just before the subcommand.
- (#507) The `messages()` revset function now ignores trailing newlines in commit messages.

## [0.4.0] - 2022-08-09

Expand Down
38 changes: 38 additions & 0 deletions git-branchless/src/revset/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,44 @@ mod tests {
"###);
}

{
let expr = Expr::FunctionCall(
Cow::Borrowed("message"),
vec![Expr::Name(Cow::Borrowed("exact:create test4.txt"))],
);
insta::assert_debug_snapshot!(eval_and_sort(&effects, &repo, &mut dag, &expr), @r###"
Ok(
[
Commit {
inner: Commit {
id: bf0d52a607f693201512a43b6b5a70b2a275e0ad,
summary: "create test4.txt",
},
},
],
)
"###);
}

{
let expr = Expr::FunctionCall(
Cow::Borrowed("message"),
vec![Expr::Name(Cow::Borrowed("regex:^create test4.txt$"))],
);
insta::assert_debug_snapshot!(eval_and_sort(&effects, &repo, &mut dag, &expr), @r###"
Ok(
[
Commit {
inner: Commit {
id: bf0d52a607f693201512a43b6b5a70b2a275e0ad,
summary: "create test4.txt",
},
},
],
)
"###);
}

{
let expr = Expr::FunctionCall(
Cow::Borrowed("paths.changed"),
Expand Down
1 change: 1 addition & 0 deletions git-branchless/src/revset/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pub enum PatternError {

impl Pattern {
pub fn matches_text(&self, subject: &str) -> bool {
let subject = subject.strip_suffix('\n').unwrap_or(subject);
match self {
Pattern::Exact(pattern) => pattern == subject,
Pattern::Substring(pattern) => subject.contains(pattern),
Expand Down