mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-17 18:49:55 +08:00
Improve repo migrations
Earlier we had one folder 'journal_local', when the remote would be setup a new folder called 'journal' would be created, and each all the files would be copied over. This meant the local history was being destroyed. Now, we only have 1 folder 'journal', and on 'cloning', we add the url as a remote, and do a git fetch + merge. This simplifies everything drastically, and opens the door for multiple remotes.
This commit is contained in:
@ -180,14 +180,18 @@ class GitNoteRepository {
|
||||
Future<void> merge() async {
|
||||
var repo = await git.GitRepository.load(gitDirPath);
|
||||
var branch = await repo.currentBranch();
|
||||
if (branch == null) {
|
||||
var branchConfig = repo.config.branch(branch);
|
||||
if (branchConfig == null) {
|
||||
logExceptionWarning(Exception("Current Branch null"), StackTrace.current);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(branchConfig.name != null);
|
||||
assert(branchConfig.merge != null);
|
||||
|
||||
try {
|
||||
await _gitRepo.merge(
|
||||
branch: branch.remoteTrackingBranch(),
|
||||
branch: branchConfig.remoteTrackingBranch(),
|
||||
authorEmail: settings.gitAuthorEmail,
|
||||
authorName: settings.gitAuthor,
|
||||
);
|
||||
|
Reference in New Issue
Block a user