Fixed stage all when there are removed files
This commit is contained in:
parent
3cb7d25a33
commit
c5f7ddf266
@ -39,15 +39,10 @@ class StatusManager @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun stage(git: Git, statusEntry: StatusEntry) = withContext(Dispatchers.IO) {
|
suspend fun stage(git: Git, statusEntry: StatusEntry) = withContext(Dispatchers.IO) {
|
||||||
if (statusEntry.statusType == StatusType.REMOVED) {
|
git.add()
|
||||||
git.rm()
|
.addFilepattern(statusEntry.filePath)
|
||||||
.addFilepattern(statusEntry.filePath)
|
.setUpdate(statusEntry.statusType == StatusType.REMOVED)
|
||||||
.call()
|
.call()
|
||||||
} else {
|
|
||||||
git.add()
|
|
||||||
.addFilepattern(statusEntry.filePath)
|
|
||||||
.call()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun stageHunk(git: Git, diffEntry: DiffEntry, hunk: Hunk) = withContext(Dispatchers.IO) {
|
suspend fun stageHunk(git: Git, diffEntry: DiffEntry, hunk: Hunk) = withContext(Dispatchers.IO) {
|
||||||
@ -160,7 +155,7 @@ class StatusManager @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
splitted = splitted.mapIndexed { index, line ->
|
splitted = splitted.mapIndexed { index, line ->
|
||||||
val lineWithBreak = line +lineDelimiter.orEmpty()
|
val lineWithBreak = line + lineDelimiter.orEmpty()
|
||||||
|
|
||||||
if (index == splitted.count() - 1 && !content.endsWith(lineWithBreak)) {
|
if (index == splitted.count() - 1 && !content.endsWith(lineWithBreak)) {
|
||||||
line
|
line
|
||||||
@ -238,6 +233,12 @@ class StatusManager @Inject constructor(
|
|||||||
git
|
git
|
||||||
.add()
|
.add()
|
||||||
.addFilepattern(".")
|
.addFilepattern(".")
|
||||||
|
.setUpdate(true) // Modified and deleted files
|
||||||
|
.call()
|
||||||
|
git
|
||||||
|
.add()
|
||||||
|
.addFilepattern(".")
|
||||||
|
.setUpdate(false) // For newly added files
|
||||||
.call()
|
.call()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user