Package org.eclipse.jgit.lfs.internal
Class LfsConfig
java.lang.Object
org.eclipse.jgit.lfs.internal.LfsConfig
Encapsulate access to the .lfsconfig.
According to the document
https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-config.5.ronn
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.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ConfigCreate an empty config as fallback to avoid null pointer checks.Get string value or null if not found.private Configload()Read the .lfsconfig file from the repositoryprivate ConfigTry to read the lfs config from an entry called .lfsconfig contained in the head revision.private ConfigTry to read the lfs config from an entry called .lfsconfig contained in the index.private ConfigTry to read the lfs config from a file called .lfsconfig at the top level of the working tree.
-
Field Details
-
db
-
delegate
-
-
Constructor Details
-
LfsConfig
Create a new instance of the LfsConfig.- Parameters:
db- the associated repo- Throws:
IOException
-
-
Method Details
-
load
Read the .lfsconfig file from the repository- Returns:
- The loaded lfs config or null if it does not exist
- Throws:
IOException
-
loadFromWorkingTree
Try to read the lfs config from a file called .lfsconfig at the top level of the working tree.- Returns:
- the config, or
null - Throws:
IOException
-
loadFromIndex
Try to read the lfs config from an entry called .lfsconfig contained in the index.- Returns:
- the config, or
nullif the entry does not exist - Throws:
IOException
-
loadFromHead
Try to read the lfs config from an entry called .lfsconfig contained in the head revision.- Returns:
- the config, or
nullif the file does not exist - Throws:
IOException
-
emptyConfig
Create an empty config as fallback to avoid null pointer checks.- Returns:
- an empty config
-
getString
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- the sectionsubsection- the subsection for the valuename- the key name- Returns:
- a String value from the config,
nullif not found
-