优化git提交校验
This commit is contained in:
@@ -51,11 +51,11 @@ class TimeSkewCommitCheckHandler(private val project: Project?) : CheckinHandler
|
|||||||
val app = ApplicationManager.getApplication()
|
val app = ApplicationManager.getApplication()
|
||||||
val picked =
|
val picked =
|
||||||
if (app.isDispatchThread) {
|
if (app.isDispatchThread) {
|
||||||
showSkewDialog(project)
|
showSkewWarning(project)
|
||||||
} else {
|
} else {
|
||||||
val choice = AtomicInteger(0)
|
val choice = AtomicInteger(0)
|
||||||
app.invokeAndWait(
|
app.invokeAndWait(
|
||||||
{ choice.set(showSkewDialog(project)) },
|
{ choice.set(showSkewWarning(project)) },
|
||||||
ModalityState.defaultModalityState(),
|
ModalityState.defaultModalityState(),
|
||||||
)
|
)
|
||||||
choice.get()
|
choice.get()
|
||||||
@@ -68,20 +68,17 @@ class TimeSkewCommitCheckHandler(private val project: Project?) : CheckinHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showSkewDialog(project: Project?): Int {
|
private fun showSkewWarning(project: Project?): Int {
|
||||||
val title = "系统时间可能不准确"
|
return Messages.showDialog(
|
||||||
val message =
|
project,
|
||||||
"""
|
"""
|
||||||
本机时间与网络标准时间相差超过 1 分钟,可能导致提交记录时间异常。
|
本机时间与网络标准时间相差超过 1 分钟,可能导致提交记录时间异常。
|
||||||
|
|
||||||
建议校准:Windows「设置 → 时间和语言 → 日期和时间」中开启自动设置时间。
|
建议校准:Windows「设置 → 时间和语言 → 日期和时间」中开启自动设置时间。
|
||||||
|
|
||||||
「确定」:继续本次提交;「取消」:中止本次提交(本地修改保留)。
|
点击「确定」继续提交;点击「取消」中止提交(不会回退本地文件)。
|
||||||
""".trimIndent()
|
""".trimIndent(),
|
||||||
return Messages.showDialog(
|
"系统时间可能不准确",
|
||||||
project,
|
|
||||||
message,
|
|
||||||
title,
|
|
||||||
arrayOf("确定", "取消"),
|
arrayOf("确定", "取消"),
|
||||||
0,
|
0,
|
||||||
Messages.getWarningIcon(),
|
Messages.getWarningIcon(),
|
||||||
|
|||||||
Reference in New Issue
Block a user