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

public Class GitStatusChecker

extends Object
Class Inheritance
Imports
java.io.IOException, java.nio.file.Path, java.util.Optional, org.jabref.logic.JabRefException, org.jabref.logic.git.GitHandler, org.jabref.logic.git.io.GitRevisionLocator, org.jabref.logic.git.preferences.GitPreferences, org.jabref.logic.git.util.GitExceptionUtil, org.jabref.logic.l10n.Localization, org.eclipse.jgit.api.Git, .LsRemoteCommand, .Status, org.eclipse.jgit.api.errors.GitAPIException, .JGitInternalException, org.eclipse.jgit.lib.BranchConfig, .ObjectId, .Ref, .Repository, org.slf4j.Logger, .LoggerFactory

This class is used to determine the status of a Git repository from any given path inside it. If no repository is found, it returns a GitStatusSnapshot with tracking = false. Otherwise, it returns a full snapshot including tracking status, sync status, and conflict state.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static GitStatusSnapshot
checkStatus(GitHandler gitHandler)

public static GitStatusSnapshot
checkStatus(Path anyPathInsideRepo, GitPreferences gitPreferences)

public static GitStatusSnapshot
public static GitStatusSnapshot
private static SyncStatus
determineSyncStatus(Repository repo, ObjectId localHead, ObjectId remoteHead)

private static SyncStatus
determineSyncStatusWithoutRemoteHead(GitHandler gitHandler)

The remote is only consulted to tell "remote exists but is empty" apart from "cannot tell".

public static boolean
private static JabRefException
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

GitStatusCheckerback to summary
public GitStatusChecker()

Method Detail

checkStatusback to summary
public static GitStatusSnapshot checkStatus(GitHandler gitHandler)
checkStatusback to summary
public static GitStatusSnapshot checkStatus(Path anyPathInsideRepo, GitPreferences gitPreferences)
checkStatusAndFetchback to summary
public static GitStatusSnapshot checkStatusAndFetch(GitHandler gitHandler) throws JabRefException
checkStatusOrThrowback to summary
public static GitStatusSnapshot checkStatusOrThrow(GitHandler gitHandler) throws JabRefException
determineSyncStatusback to summary
private static SyncStatus determineSyncStatus(Repository repo, ObjectId localHead, ObjectId remoteHead) throws IOException
determineSyncStatusWithoutRemoteHeadback to summary
private static SyncStatus determineSyncStatusWithoutRemoteHead(GitHandler gitHandler)

The remote is only consulted to tell "remote exists but is empty" apart from "cannot tell". Any failure to reach it (no origin, unsupported or unreachable URI, ...) must not affect the local working-tree result the caller relies on, so it degrades to SyncStatus#UNKNOWN.

isRemoteEmptyback to summary
public static boolean isRemoteEmpty(GitHandler gitHandler) throws IOException, GitAPIException
translateStatusFailureback to summary
private static JabRefException translateStatusFailure(Exception exception)