You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(amazonq): update logic for converting gitignore pattern to regex (aws#5360)
* fix(amazonq): update logic for converting gitignore pattern to regex
* fix(amazonq): update logic for converting gitignore pattern to regex
---------
Co-authored-by: Gaurav Gandhi <gangaur@amazon.com>
Co-authored-by: Richard Li <742829+rli@users.noreply.github.com>
Copy file name to clipboardexpand all lines: plugins/amazonq/chat/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/FeatureDevSessionContextTest.kt
+45
Original file line number
Diff line number
Diff line change
@@ -161,4 +161,49 @@ class FeatureDevSessionContextTest : FeatureDevTestBase(HeavyJavaCodeInsightTest
161
161
162
162
assertEquals(zippedFiles, expectedFiles)
163
163
}
164
+
165
+
@Test
166
+
funtestConvertGitIgnorePatternToRegex() {
167
+
val sampleGitIgnorePatterns =listOf(".*", "build/", "*.txt", "*.png")
168
+
val sampleFileNames =listOf(
169
+
".gitignore/",
170
+
".env/",
171
+
"file.txt/",
172
+
".git/config/",
173
+
"src/file.txt/",
174
+
"build/",
175
+
"build/output.jar/",
176
+
"builds/",
177
+
"mybuild/",
178
+
"build.json/",
179
+
"log.txt/",
180
+
"file.txt.json/",
181
+
"file.png/",
182
+
"src/file.png/"
183
+
)
184
+
185
+
val patterns = sampleGitIgnorePatterns.map { pattern -> featureDevSessionContext.convertGitIgnorePatternToRegex(pattern).toRegex() }
186
+
187
+
val matchedFiles = sampleFileNames.filter { fileName ->
Copy file name to clipboardexpand all lines: plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt
+11-4
Original file line number
Diff line number
Diff line change
@@ -279,10 +279,17 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
279
279
}
280
280
281
281
// gitignore patterns are not regex, method update needed.
0 commit comments