Added try catch that unlocks the dir cache in case of error in hunk unstage
This commit is contained in:
parent
a8ed01784d
commit
2e157aa773
@ -167,6 +167,8 @@ class StatusManager @Inject constructor(
|
||||
val repository = git.repository
|
||||
val dirCache = repository.lockDirCache()
|
||||
val dirCacheEditor = dirCache.editor()
|
||||
var completedWithErrors = true
|
||||
try {
|
||||
|
||||
val rawFileManager = rawFileManagerFactory.create(git.repository)
|
||||
val rawFile = rawFileManager.getRawContent(DiffEntry.Side.NEW, diffEntry)
|
||||
@ -201,7 +203,13 @@ class StatusManager @Inject constructor(
|
||||
dirCacheEditor.add(HunkEdit(diffEntry.newPath, repository, ByteBuffer.wrap(stagedFileText.toByteArray())))
|
||||
dirCacheEditor.commit()
|
||||
|
||||
completedWithErrors = false
|
||||
|
||||
loadStatus(git)
|
||||
} finally {
|
||||
if(completedWithErrors)
|
||||
dirCache.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTextLines(rawFile: RawText): List<String> {
|
||||
|
Loading…
Reference in New Issue
Block a user