Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.git

public Class GitSyncService

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.Path, java.util.List, .Optional, org.jabref.logic.JabRefException, org.jabref.logic.git.conflicts.ThreeWayEntryConflict, org.jabref.logic.git.io.GitFileReader, .GitRevisionLocator, .RevisionTriple, org.jabref.logic.git.merge.execution.MergeBookkeeper, org.jabref.logic.git.merge.planning.SemanticMergeAnalyzer, org.jabref.logic.git.model.BookkeepingResult, .MergeAnalysis, .MergePlan, .PullPlan, .PushResult, org.jabref.logic.git.status.GitStatusChecker, .GitStatusSnapshot, .SyncStatus, org.jabref.logic.git.util.GitHandlerRegistry, org.jabref.logic.importer.ImportFormatPreferences, org.jabref.model.database.BibDatabaseContext, org.eclipse.jgit.api.Git, org.eclipse.jgit.api.errors.GitAPIException, org.eclipse.jgit.revwalk.RevCommit

GitSyncService currently serves as an orchestrator for Git pull/push logic (Not responsible for writing.).

if (hasConflict) → UI merge; else → autoMerge := local + remoteDiff

Field Summary

Modifier and TypeField and Description
private final MergeBookkeeper
private final GitHandlerRegistry
private final ImportFormatPreferences

Constructor Summary

AccessConstructor and Description
public
GitSyncService(ImportFormatPreferences importFormatPreferences, GitHandlerRegistry gitHandlerRegistry, MergeBookkeeper bookkeeper)

Method Summary

Modifier and TypeMethod and Description
public static GitSyncService
create(ImportFormatPreferences importFormatPreferences, GitHandlerRegistry registry)

public BookkeepingResult
finalizeMerge(Path bibFilePath, PullPlan computation)

Phase-2: finalize after GUI saved the file with applied plan.

public Optional<PullPlan>
prepareMerge(BibDatabaseContext localDatabaseContext, Path bibFilePath)

compute merge inputs/outputs for GUI

public PushResult
push(BibDatabaseContext localDatabaseContext, Path bibFilePath)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bookkeeperback to summary
private final MergeBookkeeper bookkeeper
gitHandlerRegistryback to summary
private final GitHandlerRegistry gitHandlerRegistry
importFormatPreferencesback to summary
private final ImportFormatPreferences importFormatPreferences

Constructor Detail

GitSyncServiceback to summary
public GitSyncService(ImportFormatPreferences importFormatPreferences, GitHandlerRegistry gitHandlerRegistry, MergeBookkeeper bookkeeper)

Method Detail

createback to summary
public static GitSyncService create(ImportFormatPreferences importFormatPreferences, GitHandlerRegistry registry)
finalizeMergeback to summary
public BookkeepingResult finalizeMerge(Path bibFilePath, PullPlan computation) throws GitAPIException, IOException, JabRefException

Phase-2: finalize after GUI saved the file with applied plan.

Responsibilities:

  • (Re)open repo, stage bib file
  • For BEHIND: fast-forward or create commit consistent with GUI-saved tree
  • For DIVERGED: merge commit with parents (localHead, remote)

Preconditions:

  • The bib file on disk already reflects: local + autoPlan (+ resolvedPlan)
  • No uncommitted unrelated changes
prepareMergeback to summary
public Optional<PullPlan> prepareMerge(BibDatabaseContext localDatabaseContext, Path bibFilePath) throws GitAPIException, IOException, JabRefException

compute merge inputs/outputs for GUI

pushback to summary
public PushResult push(BibDatabaseContext localDatabaseContext, Path bibFilePath) throws GitAPIException, IOException, JabRefException