Skip to content

Commit

Permalink
[FIX] runbot: Fix no such file FETCH_HEAD
Browse files Browse the repository at this point in the history
Closes #80
  • Loading branch information
moylop260 authored and odony committed Oct 9, 2015
1 parent 0eff39d commit 0271ce0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions runbot/runbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,14 @@ def update_git(self, cr, uid, repo, context=None):
run(['git', 'clone', '--bare', repo.name, repo.path])

# check for mode == hook
fetch_time = os.path.getmtime(os.path.join(repo.path, 'FETCH_HEAD'))
if repo.mode == 'hook' and repo.hook_time and dt2time(repo.hook_time) < fetch_time:
t0 = time.time()
_logger.debug('repo %s skip hook fetch fetch_time: %ss ago hook_time: %ss ago', repo.name, int(t0 - fetch_time), int(t0 - dt2time(repo.hook_time)))
return
fname_fetch_head = os.path.join(repo.path, 'FETCH_HEAD')
if os.path.isfile(fname_fetch_head):
fetch_time = os.path.getmtime(fname_fetch_head)
if repo.mode == 'hook' and repo.hook_time and dt2time(repo.hook_time) < fetch_time:
t0 = time.time()
_logger.debug('repo %s skip hook fetch fetch_time: %ss ago hook_time: %ss ago',
repo.name, int(t0 - fetch_time), int(t0 - dt2time(repo.hook_time)))
return

repo.git(['gc', '--auto', '--prune=all'])
repo.git(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
Expand Down

0 comments on commit 0271ce0

Please sign in to comment.