Skip to content

Commit e312ebc

Browse files
committed
Merge branch 'push-tlupsyypvmpk' into 'master'
Add support for jujutsu See merge request mkjeldsen/commitmsgfmt!80
2 parents 5a824a5 + 211e7a6 commit e312ebc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/parser.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ pub fn parse<'a>(input: &'a str, comment_string: &str) -> Vec<Token<'a>> {
7070
let t = if &line[index..] == " ------------------------ >8 ------------------------" {
7171
has_scissors = true;
7272
Token::Scissored(line)
73+
} else if line[index..].starts_with(" ignore-rest") {
74+
has_scissors = true;
75+
Token::Scissored(line)
7376
} else {
7477
Token::Comment(line)
7578
};
@@ -1773,4 +1776,35 @@ do
17731776
],
17741777
);
17751778
}
1779+
#[test]
1780+
fn parses_jj_ignore_content() {
1781+
assert_eq!(
1782+
super::parse(
1783+
"
1784+
subject
1785+
1786+
# ignore-rest
1787+
above is not a comment;
1788+
do the needful
1789+
1790+
JJ: ignore-rest, including this because it should be a prefix match
1791+
do
1792+
not
1793+
format
1794+
",
1795+
"JJ:"
1796+
),
1797+
[
1798+
VerticalSpace,
1799+
Subject("subject"),
1800+
VerticalSpace,
1801+
Paragraph("# ignore-rest above is not a comment; do the needful".into()),
1802+
VerticalSpace,
1803+
Scissored("JJ: ignore-rest, including this because it should be a prefix match"),
1804+
Scissored("do"),
1805+
Scissored(" not"),
1806+
Scissored(" format"),
1807+
],
1808+
);
1809+
}
17761810
}

0 commit comments

Comments
 (0)