mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-25 16:19:58 +08:00
Use dart-git's merge when cloning
This commit is contained in:
@ -258,22 +258,13 @@ class GitNoteRepository {
|
||||
Log.e("Failed to get remote refs", ex: r.error, stacktrace: r.stackTrace);
|
||||
return fail(r);
|
||||
}
|
||||
var remoteBranchRef = r.getOrThrow();
|
||||
|
||||
if (useDartGit || AppSettings.instance.experimentalGitMerge) {
|
||||
var hash = remoteBranchRef.hash!;
|
||||
var commit = await repo.objStorage.read(hash).getOrThrow();
|
||||
await repo
|
||||
.merge(
|
||||
theirCommit: commit as GitCommit,
|
||||
author: GitAuthor(
|
||||
email: settings.gitAuthorEmail,
|
||||
name: settings.gitAuthor,
|
||||
),
|
||||
message: "Merging ...",
|
||||
)
|
||||
.throwOnError();
|
||||
return Result(null);
|
||||
var author = GitAuthor(
|
||||
email: settings.gitAuthorEmail,
|
||||
name: settings.gitAuthor,
|
||||
);
|
||||
return repo.mergeCurrentTrackingBranch(author: author);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -91,11 +91,17 @@ Future<Result<void>> cloneRemote({
|
||||
var remoteBranchR = await repo.remoteBranch(remoteName, remoteBranchName);
|
||||
if (remoteBranchR.isSuccess) {
|
||||
Log.i("Merging '$remoteName/$remoteBranchName'");
|
||||
await _gitRepo.merge(
|
||||
branch: '$remoteName/$remoteBranchName',
|
||||
authorName: authorName,
|
||||
authorEmail: authorEmail,
|
||||
);
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await _gitRepo.merge(
|
||||
branch: '$remoteName/$remoteBranchName',
|
||||
authorName: authorName,
|
||||
authorEmail: authorEmail,
|
||||
);
|
||||
} else {
|
||||
var repo = await GitRepository.load(repoPath).getOrThrow();
|
||||
var author = GitAuthor(name: authorName, email: authorEmail);
|
||||
repo.mergeCurrentTrackingBranch(author: author).throwOnError();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.i("Completing - localBranch diff remote: $branch $remoteBranchName");
|
||||
@ -106,11 +112,17 @@ Future<Result<void>> cloneRemote({
|
||||
await repo.setUpstreamTo(remote, remoteBranchName).getOrThrow();
|
||||
|
||||
Log.i("Merging '$remoteName/$remoteBranchName'");
|
||||
await _gitRepo.merge(
|
||||
branch: '$remoteName/$remoteBranchName',
|
||||
authorName: authorName,
|
||||
authorEmail: authorEmail,
|
||||
);
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await _gitRepo.merge(
|
||||
branch: '$remoteName/$remoteBranchName',
|
||||
authorName: authorName,
|
||||
authorEmail: authorEmail,
|
||||
);
|
||||
} else {
|
||||
var repo = await GitRepository.load(repoPath).getOrThrow();
|
||||
var author = GitAuthor(name: authorName, email: authorEmail);
|
||||
repo.mergeCurrentTrackingBranch(author: author).throwOnError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: b9d57da376b1d3156c306a835e64c9a98d759a4d
|
||||
resolved-ref: "85eb017910093d10610159f984ffcfdc42bf4e83"
|
||||
url: "https://github.com/GitJournal/dart-git.git"
|
||||
source: git
|
||||
version: "0.0.2"
|
||||
|
Reference in New Issue
Block a user