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); await file.copy(toPath);
var gitRepo = GitRepo( var gitRepo = GitRepo(folderPath: toGitRepoPath);
folderPath: toGitRepoPath, await gitRepo.add(fileName);
await gitRepo.commit(
message: "Added Note",
authorEmail: Settings.instance.gitAuthorEmail, authorEmail: Settings.instance.gitAuthorEmail,
authorName: Settings.instance.gitAuthor, authorName: Settings.instance.gitAuthor,
); );
await gitRepo.add(fileName);
await gitRepo.commit(message: "Added Note");
} }
Log.d("migrateGitRepo: Done"); Log.d("migrateGitRepo: Done");
} }

View File

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

View File

@ -477,11 +477,13 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
var repo = GitRepo( var repo = GitRepo(
folderPath: repoPath, folderPath: repoPath,
authorName: Settings.instance.gitAuthor,
authorEmail: Settings.instance.gitAuthorEmail,
); );
await repo.add('.gitignore'); 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( getAnalytics().logEvent(

View File

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

View File

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