mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-27 17:29:50 +08:00
GitMerge: For now just take THEIRS as the Merge Strategy
In the future, our strategy can be that we take whichever file has been modified the latest. That's actually far more reasonable.
This commit is contained in:
@ -9,6 +9,7 @@ import org.eclipse.jgit.api.errors.GitAPIException;
|
|||||||
import org.eclipse.jgit.api.PullCommand;
|
import org.eclipse.jgit.api.PullCommand;
|
||||||
import org.eclipse.jgit.api.TransportConfigCallback;
|
import org.eclipse.jgit.api.TransportConfigCallback;
|
||||||
import org.eclipse.jgit.api.errors.TransportException;
|
import org.eclipse.jgit.api.errors.TransportException;
|
||||||
|
import org.eclipse.jgit.merge.MergeStrategy;
|
||||||
import org.eclipse.jgit.transport.Transport;
|
import org.eclipse.jgit.transport.Transport;
|
||||||
import org.eclipse.jgit.transport.SshTransport;
|
import org.eclipse.jgit.transport.SshTransport;
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ public class GitPullTask extends AsyncTask<String, Void, Void> {
|
|||||||
try {
|
try {
|
||||||
Git git = Git.open(cloneDir);
|
Git git = Git.open(cloneDir);
|
||||||
|
|
||||||
PullCommand pullCommand = git.pull();
|
PullCommand pullCommand = git.pull().setStrategy(MergeStrategy.THEIRS);
|
||||||
pullCommand.setTransportConfigCallback(new TransportConfigCallback() {
|
pullCommand.setTransportConfigCallback(new TransportConfigCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void configure(Transport transport) {
|
public void configure(Transport transport) {
|
||||||
|
Reference in New Issue
Block a user