comparison tests/test-hgignore.t @ 49605:b3480822a251 stable

matcher: do not prepend '.*' to pattern using ^ after flags Since the previous commit (fixing wider issue), the code generated strange regex. This is now fixed and tested.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 16 Nov 2022 15:39:10 +0100
parents 086b0c4f8663
children
comparison
equal deleted inserted replaced
49604:086b0c4f8663 49605:b3480822a251
72 $ echo 're:.hgignore' >> .hgignore 72 $ echo 're:.hgignore' >> .hgignore
73 $ hg status 73 $ hg status
74 A dir/b.o 74 A dir/b.o
75 ? a.c 75 ? a.c
76 ? syntax 76 ? syntax
77 $ hg debugignore
78 <includematcher includes='(?i:.*\\.O$)|.*.hgignore'>
77 79
78 regex with flag is not the first one 80 regex with flag is not the first one
79 81
80 $ echo 're:.hgignore' > .hgignore 82 $ echo 're:.hgignore' > .hgignore
81 $ echo 're:(?i)\.O$' >> .hgignore 83 $ echo 're:(?i)\.O$' >> .hgignore
82 $ hg status 84 $ hg status
83 A dir/b.o 85 A dir/b.o
84 ? a.c 86 ? a.c
85 ? syntax 87 ? syntax
88 $ hg debugignore
89 <includematcher includes='.*.hgignore|(?i:.*\\.O$)'>
86 90
87 flag in a pattern should affect that pattern only 91 flag in a pattern should affect that pattern only
88 92
89 $ echo 're:(?i)\.O$' > .hgignore 93 $ echo 're:(?i)\.O$' > .hgignore
90 $ echo 're:.HGIGNORE' >> .hgignore 94 $ echo 're:.HGIGNORE' >> .hgignore
91 $ hg status 95 $ hg status
92 A dir/b.o 96 A dir/b.o
93 ? .hgignore 97 ? .hgignore
94 ? a.c 98 ? a.c
95 ? syntax 99 ? syntax
100 $ hg debugignore
101 <includematcher includes='(?i:.*\\.O$)|.*.HGIGNORE'>
96 102
97 $ echo 're:.HGIGNORE' > .hgignore 103 $ echo 're:.HGIGNORE' > .hgignore
98 $ echo 're:(?i)\.O$' >> .hgignore 104 $ echo 're:(?i)\.O$' >> .hgignore
99 $ hg status 105 $ hg status
100 A dir/b.o 106 A dir/b.o
101 ? .hgignore 107 ? .hgignore
102 ? a.c 108 ? a.c
103 ? syntax 109 ? syntax
110 $ hg debugignore
111 <includematcher includes='.*.HGIGNORE|(?i:.*\\.O$)'>
112
113 Check that '^' after flag is properly detected.
114
115 $ echo 're:(?i)^[^a].*\.O$' > .hgignore
116 $ echo 're:.HGIGNORE' >> .hgignore
117 $ hg status
118 A dir/b.o
119 ? .hgignore
120 ? a.c
121 ? a.o
122 ? syntax
123 $ hg debugignore
124 <includematcher includes='(?i:^[^a].*\\.O$)|.*.HGIGNORE'>
125
126 $ echo 're:.HGIGNORE' > .hgignore
127 $ echo 're:(?i)^[^a].*\.O$' >> .hgignore
128 $ hg status
129 A dir/b.o
130 ? .hgignore
131 ? a.c
132 ? a.o
133 ? syntax
134 $ hg debugignore
135 <includematcher includes='.*.HGIGNORE|(?i:^[^a].*\\.O$)'>
104 136
105 137
106 further testing 138 further testing
107 --------------- 139 ---------------
108 140