Top Description Fields Constructors Methods
org.eclipse.jgit.lfs.internal

public Class LfsConfig

extends Object
Class Inheritance
Imports
java.io.File, .IOException, org.eclipse.jgit.annotations.Nullable, org.eclipse.jgit.dircache.DirCacheEntry, org.eclipse.jgit.errors.ConfigInvalidException, org.eclipse.jgit.lfs.errors.LfsConfigInvalidException, org.eclipse.jgit.lfs.lib.Constants, org.eclipse.jgit.lib.BlobBasedConfig, .Config, .ObjectId, .Repository, org.eclipse.jgit.revwalk.RevCommit, .RevTree, .RevWalk, org.eclipse.jgit.storage.file.FileBasedConfig, org.eclipse.jgit.treewalk.TreeWalk

Encapsulate access to the .lfsconfig.

According to the git lfs documentation the order to find the .lfsconfig file is:

  1. in the root of the working tree
  2. in the index
  3. in the HEAD; for bare repositories this is the only place that is searched

Values from the .lfsconfig are used only if not specified in another git config file to allow local override without modifiction of a committed file.

See Also
Configuration options for git-lfs

Field Summary

Modifier and TypeField and Description
private Repository
private Config

Constructor Summary

AccessConstructor and Description
public
LfsConfig(Repository
the associated repo
db
)

Create a new instance of the LfsConfig.

Method Summary

Modifier and TypeMethod and Description
private Config

Returns:

an empty config
emptyConfig
()

Create an empty config as fallback to avoid null pointer checks.

private Config

Returns:

the delegate Config
getDelegate
()

Getter for the delegate to allow lazy initialization.

public String

Returns:

a String value from the config, null if not found
getString
(final String
the section
section
,
final String
the subsection for the value
subsection
,
final String
the key name
name
)

Get string value or null if not found.

private Config

Returns:

The loaded lfs config
load
()

Read the .lfsconfig file from the repository An empty config is returned be empty if no lfs config exists.

private Config

Returns:

the config, or null if the file does not exist
loadFromHead
()

Try to read the lfs config from an entry called .lfsconfig contained in the head revision.

private Config

Returns:

the config, or null if the entry does not exist
loadFromIndex
()

Try to read the lfs config from an entry called .lfsconfig contained in the index.

private Config

Returns:

the config, or null
loadFromWorkingTree
()

Try to read the lfs config from a file called .lfsconfig at the top level of the working tree.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dbback to summary
private Repository db
delegateback to summary
private Config delegate

Constructor Detail

LfsConfigback to summary
public LfsConfig(Repository db)

Create a new instance of the LfsConfig.

Parameters
db:Repository

the associated repo

Method Detail

emptyConfigback to summary
private Config emptyConfig()

Create an empty config as fallback to avoid null pointer checks.

Returns:Config

an empty config

getDelegateback to summary
private Config getDelegate() throws IOException

Getter for the delegate to allow lazy initialization.

Returns:Config

the delegate Config

Exceptions
IOException:
if an IO error occurred
getStringback to summary
public String getString(final String section, final String subsection, final String name) throws IOException

Get string value or null if not found. First tries to find the value in the git config files. If not found tries to find data in .lfsconfig.

Parameters
section:String

the section

subsection:String

the subsection for the value

name:String

the key name

Returns:String

a String value from the config, null if not found

Annotations
@Nullable
Exceptions
IOException:
if an IO error occurred
loadback to summary
private Config load() throws IOException

Read the .lfsconfig file from the repository An empty config is returned be empty if no lfs config exists.

Returns:Config

The loaded lfs config

Exceptions
IOException:
if an IO error occurred
loadFromHeadback to summary
private Config loadFromHead() throws IOException

Try to read the lfs config from an entry called .lfsconfig contained in the head revision.

Returns:Config

the config, or null if the file does not exist

Annotations
@Nullable
Exceptions
IOException:
if an IO error occurred
loadFromIndexback to summary
private Config loadFromIndex() throws IOException

Try to read the lfs config from an entry called .lfsconfig contained in the index.

Returns:Config

the config, or null if the entry does not exist

Annotations
@Nullable
Exceptions
IOException:
if an IO error occurred
loadFromWorkingTreeback to summary
private Config loadFromWorkingTree() throws IOException

Try to read the lfs config from a file called .lfsconfig at the top level of the working tree.

Returns:Config

the config, or null

Annotations
@Nullable
Exceptions
IOException:
if an IO error occurred