Skip to content

Commit 6f9183d

Browse files
committed
Bug fix: 修改更新判断策略
1 parent 88c63a9 commit 6f9183d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/update.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
with open(os.path.join(HOME_PATH, 'VERSION'), 'r') as f:
88
VERSION = f.read().strip()
99

10-
flag = False
1110

1211
def check_update(repo: git.Repo, remote: git.Remote):
13-
global flag
1412
remote.fetch()
15-
status = repo.is_dirty()
16-
flag = True
17-
return status
13+
local_branch = repo.active_branch
14+
remote_branch = repo.remotes.origin.refs[local_branch.name]
15+
return local_branch.commit != remote_branch.commit
1816

1917
def update():
2018
repo = git.Repo(HOME_PATH)

0 commit comments

Comments
 (0)