mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-20 15:00:28 +08:00
Allow git pulls to fail
They fail when there is nothing to pull because no commit exists on the server.
This commit is contained in:
@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:fimber/fimber.dart';
|
||||||
|
|
||||||
import 'package:git_bindings/git_bindings.dart';
|
import 'package:git_bindings/git_bindings.dart';
|
||||||
|
|
||||||
@ -102,8 +103,18 @@ class GitNoteRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sync() async {
|
Future<void> sync() async {
|
||||||
|
try {
|
||||||
await _gitRepo.pull();
|
await _gitRepo.pull();
|
||||||
|
} on GitException catch (ex) {
|
||||||
|
Fimber.d(ex.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
await _gitRepo.push();
|
await _gitRepo.push();
|
||||||
|
} on GitException catch (ex) {
|
||||||
|
Fimber.d(ex.toString());
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user