From 99ff3f8d4247942d613b0415e1b2589beecf70b0 Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Mon, 3 Apr 2023 18:02:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=83=AD=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/model/command/command.py b/model/command/command.py index 6705d70e5..149bf1361 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -1,5 +1,6 @@ import abc import json +import git.exc from git.repo import Repo import os import sys @@ -22,7 +23,10 @@ class Command: l = message.split(" ") if len(l) == 1: # 得到本地版本号和最新版本号 - repo = Repo() + try: + repo = Repo() + except git.exc.InvalidGitRepositoryError: + repo = Repo(path="QQChannelChatGPT") now_commit = repo.head.commit # 得到最新的5条commit列表, 包含commit信息