mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-13061 Settings Sync java.lang.AssertionError: Checkout conflict with files: .metainfo/plugins.json
GitOrigin-RevId: 2c8d6a1f44dcb2b5c21d481e2d325d6241da9acd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
cc586400ab
commit
5a537f9f7b
@@ -318,6 +318,8 @@ class GitSettingsLog(private val settingsSyncStorage: Path,
|
||||
override fun collectCurrentSnapshot(): SettingsSnapshot {
|
||||
// todo check repository consistency, e.g. there should be no uncommitted changes
|
||||
git.checkout().setName(MASTER_REF_NAME).setForced(true).call()
|
||||
git.reset().setMode(ResetCommand.ResetType.HARD).call()
|
||||
git.clean().setForce(true).setCleanDirectories(true).call()
|
||||
|
||||
val lastModifiedDate = getDate(getBranchTip(master))
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.testFramework.TemporaryDirectory
|
||||
import com.intellij.ui.JBAccountInfoService
|
||||
import com.intellij.util.io.createParentDirectories
|
||||
import com.intellij.util.io.write
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.dircache.DirCache
|
||||
import org.eclipse.jgit.lib.Config
|
||||
import org.eclipse.jgit.lib.Repository
|
||||
@@ -604,6 +605,44 @@ internal class GitSettingsLogTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestFor(issues = ["IJPL-13061"])
|
||||
fun `drop for unfinished modifications`() {
|
||||
val editorXml = (configDir / "options" / "editor.xml").write("Editor Initial")
|
||||
val lafXml = (configDir / "options" / "laf.xml").write("LaF Initial")
|
||||
val generalXml = (configDir / "options" / "ide.general.xml").write("General Initial")
|
||||
|
||||
val settingsLog = initializeGitSettingsLog(lafXml, editorXml)
|
||||
|
||||
|
||||
settingsLog.applyCloudState(
|
||||
settingsSnapshot {
|
||||
fileState("options/editor.xml", "Editor Cloud")
|
||||
fileState("options/ide.general.xml", "General Cloud")
|
||||
}, "Remote changes"
|
||||
)
|
||||
settingsLog.advanceMaster()
|
||||
|
||||
settingsLog.applyIdeState(
|
||||
settingsSnapshot {
|
||||
fileState("options/editor.xml", "Editor Ide")
|
||||
fileState("options/ide.general.xml", "General Ide")
|
||||
}, "Local changes"
|
||||
)
|
||||
|
||||
generalXml.write("General Cloud")
|
||||
(configDir / "settingsSync" / "options" / "ide.general.xml").write("General New")
|
||||
val repository = FileRepositoryBuilder()
|
||||
.setGitDir((configDir / "settingsSync"/ ".git").toFile())
|
||||
.setAutonomous(true).readEnvironment().build()
|
||||
val git = Git(repository)
|
||||
val addCommand = git.add()
|
||||
addCommand.addFilepattern("options/ide.general.xml")
|
||||
addCommand.call()
|
||||
|
||||
initializeGitSettingsLog(lafXml, editorXml, generalXml)
|
||||
}
|
||||
|
||||
private fun checkUsernameEmail(expectedName: String, expectedEmail: String) {
|
||||
arrayOf<FileAttribute<*>>()
|
||||
val editorXml = (configDir / "options" / "editor.xml").createParentDirectories().createFile()
|
||||
|
||||
Reference in New Issue
Block a user