File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/main/kotlin/com/jetpackduba/gitnuro/git Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,26 +47,29 @@ class FileChangesWatcher @Inject constructor(
4747
4848 override fun detectedChange (paths : Array <String >) {
4949 tabScope.launch {
50- val hasGitIgnoreChanged = paths.any { it == " $workspacePath$systemSeparator .gitignore" }
50+ val normalizedPaths = paths.map {
51+ it.removePrefix(workspacePath)
52+ }
53+ val hasGitIgnoreChanged = normalizedPaths.any { it == " $systemSeparator .gitignore" }
5154
5255 if (hasGitIgnoreChanged) {
5356 ignoreRules = getIgnoreRulesUseCase(repository)
5457 }
5558
56- val areAllPathsIgnored = paths .all { path ->
59+ val areAllPathsIgnored = normalizedPaths .all { path ->
5760 val matchesAnyIgnoreRule = ignoreRules.any { rule ->
5861 rule.isMatch(path, Files .isDirectory(Paths .get(path)))
5962 }
6063
6164 val isGitIgnoredFile = gitDirIgnoredFiles.any { ignoredFile ->
62- " $workspacePath$ systemSeparator .git$systemSeparator$ignoredFile " == path
65+ " $systemSeparator .git$systemSeparator$ignoredFile " == path
6366 }
6467
6568 matchesAnyIgnoreRule || isGitIgnoredFile
6669 }
6770
6871 val hasGitDirChanged =
69- paths .any { it.startsWith(" $workspacePath $systemSeparator .git$systemSeparator " ) }
72+ normalizedPaths .any { it.startsWith(" $systemSeparator .git$systemSeparator " ) }
7073
7174 if (! areAllPathsIgnored) {
7275 println (" Emitting changes $hasGitIgnoreChanged " )
You can’t perform that action at this time.
0 commit comments