Removed unnecessary check

This commit is contained in:
Abdelilah El Aissaoui 2022-11-12 21:42:23 +01:00
parent 76e5237cd5
commit 4bad3a941c

View File

@ -56,17 +56,6 @@ class FileChangesWatcher @Inject constructor() {
val dir = keys[key] ?: return@withContext
if (events.count() == 1) {
val fileChanged = events.first().context().toString()
val fullPathOfFileChanged = "$pathStr$systemSeparator.git$systemSeparator$fileChanged"
// Ignore COMMIT_EDITMSG changes
if (isGitMessageFile(pathStr, fullPathOfFileChanged)) {
printLog(TAG, "Ignored changes in $fullPathOfFileChanged")
return@withContext
}
}
_changesNotifier.emit(false)
// Check if new directories have been added to add them to the watchService
@ -97,10 +86,4 @@ class FileChangesWatcher @Inject constructor() {
private fun isGitDir(dir: Path, pathStr: String): Boolean {
return dir.startsWith("$pathStr$systemSeparator.git$systemSeparator")
}
private fun isGitMessageFile(repoPath: String, fullPathOfFileChanged: String): Boolean {
val gitDir = "$repoPath$systemSeparator.git$systemSeparator"
return fullPathOfFileChanged == "${gitDir}COMMIT_EDITMSG" ||
fullPathOfFileChanged == "${gitDir}MERGE_MSG"
}
}