fix: health.py _get_vendor_commit 只返回 commit hash 而非整个文件
VENDOR_COMMIT 是多行标记文件(source/commit/date), 旧逻辑 f.read().strip() 返回整个文件内容导致 health 输出污染。 对齐 cli.py 的逐行 commit: 前缀解析逻辑。
This commit is contained in:
parent
bcf586b7c0
commit
2075fe64b9
@ -261,10 +261,18 @@ class _ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
|
||||
|
||||
|
||||
def _get_vendor_commit() -> str:
|
||||
"""读取 _vendor/VENDOR_COMMIT 文件,提取 commit hash。
|
||||
|
||||
VENDOR_COMMIT 是多行标记文件(# 注释 + source:/commit:/date:),
|
||||
只返回 commit: 行的值,不是整个文件内容。
|
||||
"""
|
||||
commit_file = os.path.join(mindcli._VENDOR_DIR, "VENDOR_COMMIT")
|
||||
try:
|
||||
with open(commit_file) as f:
|
||||
return f.read().strip()
|
||||
for line in f:
|
||||
if line.startswith("commit:"):
|
||||
return line.split(":", 1)[1].strip()
|
||||
return "unknown"
|
||||
except FileNotFoundError:
|
||||
return "unknown"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user