From 72777b96a43c8ac7ec2bc0991d4a673649db16d5 Mon Sep 17 00:00:00 2001
From: Vishesh Handa <me@vhanda.in>
Date: Thu, 2 Jan 2020 01:04:21 +0100
Subject: [PATCH] Allow git pulls to fail

They fail when there is nothing to pull because no commit exists on the
server.
---
 lib/core/git_repo.dart | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/core/git_repo.dart b/lib/core/git_repo.dart
index b0f1c683..49d0cb5a 100644
--- a/lib/core/git_repo.dart
+++ b/lib/core/git_repo.dart
@@ -2,6 +2,7 @@ import 'dart:async';
 import 'dart:io';
 
 import 'package:flutter/foundation.dart';
+import 'package:fimber/fimber.dart';
 
 import 'package:git_bindings/git_bindings.dart';
 
@@ -102,8 +103,18 @@ class GitNoteRepository {
   }
 
   Future<void> sync() async {
-    await _gitRepo.pull();
-    await _gitRepo.push();
+    try {
+      await _gitRepo.pull();
+    } on GitException catch (ex) {
+      Fimber.d(ex.toString());
+    }
+
+    try {
+      await _gitRepo.push();
+    } on GitException catch (ex) {
+      Fimber.d(ex.toString());
+      rethrow;
+    }
   }
 }