mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix local update dirty check
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
.idea/
|
.idea/
|
||||||
|
.DS_Store
|
||||||
*.c
|
*.c
|
||||||
*.so
|
*.so
|
||||||
*.pyd
|
*.pyd
|
||||||
|
|||||||
+18
-3
@@ -1425,9 +1425,24 @@ def _git_output(*args: str) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def _ensure_git_clean() -> None:
|
def _ensure_git_clean() -> None:
|
||||||
status = _git_output("status", "--porcelain")
|
status = _git_output("status", "--porcelain", "--untracked-files=no")
|
||||||
if status.strip():
|
if not status.strip():
|
||||||
raise RuntimeError("检测到当前仓库有未提交改动,请先提交或清理后再执行更新。")
|
return
|
||||||
|
|
||||||
|
changed_files: list[str] = []
|
||||||
|
for line in status.splitlines():
|
||||||
|
if len(line) < 4:
|
||||||
|
continue
|
||||||
|
changed_files.append(line[3:].strip())
|
||||||
|
|
||||||
|
detail = ""
|
||||||
|
if changed_files:
|
||||||
|
preview = "、".join(changed_files[:5])
|
||||||
|
if len(changed_files) > 5:
|
||||||
|
preview += " 等"
|
||||||
|
detail = f":{preview}"
|
||||||
|
|
||||||
|
raise RuntimeError(f"检测到当前仓库有未提交的源码改动{detail},请先提交或清理后再执行更新。")
|
||||||
|
|
||||||
|
|
||||||
def _update_backend_ref(ref: str) -> str:
|
def _update_backend_ref(ref: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user