LLM-13861 don't rewrite non default shelve list name

(cherry picked from commit ce194d5dbeb5be8f4f46cf5114341500461520c3)

IJ-CR-152138

GitOrigin-RevId: 4a3a8ad19076a2e509d74165a383e19803820998
This commit is contained in:
Dmitry Krasilschikov
2024-12-23 09:17:09 +02:00
committed by intellij-monorepo-bot
parent 85e522304a
commit a4c0812610
3 changed files with 9 additions and 1 deletions

View File

@@ -2171,11 +2171,13 @@ f:com.intellij.vcs.ShelveTitlePatch
- hashCode():I
com.intellij.vcs.ShelveTitleProvider
- sf:Companion:com.intellij.vcs.ShelveTitleProvider$Companion
- s:hasDefaultName(java.lang.String):Z
- s:showGotItTooltip(com.intellij.openapi.project.Project,java.awt.Component):V
- a:showTooltipPopup(com.intellij.openapi.project.Project,java.awt.Component):Z
- a:suggestTitle(com.intellij.openapi.project.Project,com.intellij.vcs.ShelveTitlePatch,java.util.function.Consumer):Z
f:com.intellij.vcs.ShelveTitleProvider$Companion
- f:getEP_NAME():com.intellij.openapi.extensions.ExtensionPointName
- f:hasDefaultName(java.lang.String):Z
- f:showGotItTooltip(com.intellij.openapi.project.Project,java.awt.Component):V
com.intellij.vcs.VcsRepositoryInitializer
- sf:EXTENSION_POINT_NAME:com.intellij.openapi.extensions.ExtensionPointName

View File

@@ -3,6 +3,7 @@ package com.intellij.vcs
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.project.Project
import com.intellij.openapi.vcs.changes.LocalChangeList.getAllDefaultNames
import java.awt.Component
import java.util.function.Consumer
@@ -25,6 +26,9 @@ interface ShelveTitleProvider {
fun showGotItTooltip(project: Project, component: Component) {
EP_NAME.extensionList.any { it.showTooltipPopup(project, component) }
}
@JvmStatic
fun hasDefaultName(name: String): Boolean = getAllDefaultNames().contains(name)
}
}

View File

@@ -399,7 +399,9 @@ public final class ShelveChangesManager implements PersistentStateComponent<Elem
changeList.markToDelete(markToBeDeleted);
if (Registry.is("llm.vcs.shelve.title.generation")) {
suggestBetterName(new ShelveTitlePatch(Files.readString(patchFile), patches.size()), name -> renameChangeList(changeList, name));
if (ShelveTitleProvider.hasDefaultName(commitMessage)) {
suggestBetterName(new ShelveTitlePatch(Files.readString(patchFile), patches.size()), name -> renameChangeList(changeList, name));
}
}
changeList.setName(schemePatchDir.getFileName().toString());