Bump git_bindings and pass fresh version of gitAuthor/Email

This way the Settings change for git author is immediately reflected.

Fixes #130
This commit is contained in:
Vishesh Handa
2020-05-13 11:35:14 +02:00
parent 2d62216b01
commit 66eeaa552b
5 changed files with 32 additions and 15 deletions

View File

@ -35,13 +35,13 @@ Future migrateGitRepo({
await file.copy(toPath);
var gitRepo = GitRepo(
folderPath: toGitRepoPath,
var gitRepo = GitRepo(folderPath: toGitRepoPath);
await gitRepo.add(fileName);
await gitRepo.commit(
message: "Added Note",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
await gitRepo.add(fileName);
await gitRepo.commit(message: "Added Note");
}
Log.d("migrateGitRepo: Done");
}

View File

@ -29,11 +29,7 @@ class GitNoteRepository {
GitNoteRepository({
@required this.gitDirPath,
}) : _gitRepo = GitRepo(
folderPath: gitDirPath,
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
}) : _gitRepo = GitRepo(folderPath: gitDirPath);
Future<NoteRepoResult> addNote(Note note) async {
return _addNote(note, "Added Note");
@ -44,6 +40,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: commitMessage,
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: note.filePath, error: false);
@ -53,6 +51,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Created New Folder",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: folder.folderPath, error: false);
@ -65,6 +65,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Update folder config for $pathSpec",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: config.folder.folderPath, error: false);
@ -78,6 +80,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Renamed Folder",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: newFullPath, error: false);
@ -91,6 +95,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Renamed Note",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: newFullPath, error: false);
@ -104,6 +110,8 @@ class GitNoteRepository {
await _gitRepo.add(".");
await _gitRepo.commit(
message: "Note Moved",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: newFullPath, error: false);
@ -115,6 +123,8 @@ class GitNoteRepository {
await _gitRepo.rm(spec);
await _gitRepo.commit(
message: "Removed Note " + spec,
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
return NoteRepoResult(noteFilePath: note.filePath, error: false);
@ -125,6 +135,8 @@ class GitNoteRepository {
await _gitRepo.rm(spec);
await _gitRepo.commit(
message: "Removed Folder " + spec,
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
await Directory(folder.folderPath).delete(recursive: true);
@ -143,7 +155,10 @@ class GitNoteRepository {
Future<void> pull() async {
try {
await _gitRepo.pull();
await _gitRepo.pull(
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
} on GitException catch (ex) {
Log.d(ex.toString());
}

View File

@ -477,11 +477,13 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
var repo = GitRepo(
folderPath: repoPath,
authorName: Settings.instance.gitAuthor,
authorEmail: Settings.instance.gitAuthorEmail,
);
await repo.add('.gitignore');
await repo.commit(message: "Add gitignore file");
await repo.commit(
message: "Add gitignore file",
authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor,
);
}
getAnalytics().logEvent(

View File

@ -356,7 +356,7 @@ packages:
name: git_bindings
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.12"
version: "0.0.13"
git_url_parse2:
dependency: "direct main"
description:

View File

@ -30,7 +30,7 @@ dependencies:
dynamic_theme: ^1.0.0
flutter_staggered_grid_view: ^0.3.0
provider: ^3.2.0
git_bindings: ^0.0.12
git_bindings: ^0.0.13
dart_git:
git: https://github.com/GitJournal/dart_git.git
#path: /Users/vishesh/src/gitjournal/dart_git