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