From 919a1e591987280f654d0f7c3a022c6a14f96d19 Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Mon, 19 Aug 2024 11:21:05 +0200 Subject: [PATCH] sync: fix initial sync --- watson/watson.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/watson/watson.py b/watson/watson.py index 52460f4..3f39be2 100644 --- a/watson/watson.py +++ b/watson/watson.py @@ -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)