Skip to content

Commit

Permalink
sync: fix initial sync
Browse files Browse the repository at this point in the history
  • Loading branch information
teutat3s committed Aug 19, 2024
1 parent 8cb7666 commit 919a1e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions watson/watson.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,18 +452,18 @@ def push(self, last_pull):
json.dump(frames, f, indent=2)

# Check if anything has changed
cwd = self.sync_dir
try:
command = ['git', 'diff', '--quiet']
subprocess.run(command, cwd=self.sync_dir, check=True)
subprocess.run(['git', 'add', 'frames'], cwd=cwd, check=True)
command = ['git', 'diff', '--staged', '--quiet']
subprocess.run(command, cwd=cwd, check=True)
return 0
except subprocess.CalledProcessError:
pass

# git push
cwd = self.sync_dir
updated = len(frames) - n_frames
msg = f'Add {updated} frames ({datetime.datetime.now()})'
subprocess.run(['git', 'add', 'frames'], cwd=cwd, check=True)
subprocess.run(['git', 'commit', '-m', msg], cwd=cwd, check=True)
subprocess.run(['git', 'push'], cwd=cwd, check=True)

Expand Down

0 comments on commit 919a1e5

Please sign in to comment.