mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-09-20 23:30:02 +08:00
Only do a git push if one has commits to push
This is the first use of my pure Dart implementation of Git. Hurray! Now hopefully, I can slowly get rid of git_bindings entirely.
This commit is contained in:
@ -11,6 +11,8 @@ import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||
import 'package:gitjournal/settings.dart';
|
||||
import 'package:gitjournal/utils/logger.dart';
|
||||
|
||||
import 'package:dart_git/git.dart' as git;
|
||||
|
||||
class NoteRepoResult {
|
||||
bool error;
|
||||
String noteFilePath;
|
||||
@ -148,6 +150,14 @@ class GitNoteRepository {
|
||||
}
|
||||
|
||||
Future<void> push() async {
|
||||
// Only push if we have something we need to push
|
||||
try {
|
||||
var repo = await git.GitRepository.load(gitDirPath);
|
||||
if ((await repo.canPush()) == false) {
|
||||
return;
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
try {
|
||||
await _gitRepo.push();
|
||||
} on GitException catch (ex) {
|
||||
|
23
pubspec.lock
23
pubspec.lock
@ -71,6 +71,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
buffer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: buffer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.6"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -120,6 +127,15 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
dart_git:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "121c514cb5960afaa2dcef09a0e5c285b23cc1e2"
|
||||
url: "https://github.com/GitJournal/dart_git.git"
|
||||
source: git
|
||||
version: "0.0.1"
|
||||
device_info:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -327,6 +343,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.4"
|
||||
ini:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ini
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -30,6 +30,9 @@ dependencies:
|
||||
page_transition: "^1.1.5"
|
||||
provider: ^3.2.0
|
||||
git_bindings: ^0.0.12
|
||||
dart_git:
|
||||
git: https://github.com/GitJournal/dart_git.git
|
||||
#path: /Users/vishesh/src/gitjournal/dart_git
|
||||
fetch_app_logs: ^0.0.3
|
||||
flutter_runtime_env: ^0.0.2
|
||||
yaml_serializer: ^0.0.5
|
||||
|
Reference in New Issue
Block a user