1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:29:16 +00:00

Handle case that get_commits returns empty

This commit is contained in:
zhengxie
2013-04-16 11:32:58 +08:00
parent 20673e5d3d
commit a957a616f6
2 changed files with 6 additions and 3 deletions

View File

@@ -158,10 +158,12 @@ def calculate_repo_last_modify(repo_list):
"""
for repo in repo_list:
repo.latest_modify = get_commits(repo.id, 0, 1)[0].ctime
cmmts = get_commits(repo.id, 0, 1)
repo.latest_modify = cmmts[0].ctime if cmmts else 0
def check_filename_with_rename(repo_id, parent_dir, filename):
latest_commit = get_commits(repo_id, 0, 1)[0]
cmmts = get_commits(repo_id, 0, 1)
latest_commit = cmmts[0] if cmmts else None
if not latest_commit:
return ''
# TODO: what if parrent_dir does not exist?