Package org.eclipse.jgit.lib
Class BranchConfig
- java.lang.Object
-
- org.eclipse.jgit.lib.BranchConfig
-
public class BranchConfig extends java.lang.ObjectBranch section of a Git configuration file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBranchConfig.BranchRebaseModeConfig values for branch.[name].rebase (and pull.rebase).
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringbranchNameprivate Configconfigstatic java.lang.StringLOCAL_REPOSITORYThe value that means "local repository" forgetRemote(): "."
-
Constructor Summary
Constructors Constructor Description BranchConfig(Config config, java.lang.String branchName)Create a new branch config, which will read configuration from config about specified branch.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringfindRemoteTrackingBranch(java.lang.String remote, java.lang.String mergeRef)Finds the tracked remote tracking branchjava.lang.StringgetMerge()Get the name of the upstream branch as it is called on the remoteBranchConfig.BranchRebaseModegetRebaseMode()Retrieves the config value of branch.[name].rebase.java.lang.StringgetRemote()Get the remote this branch is configured to fetch from/push toprivate java.lang.StringgetRemoteOrDefault()java.lang.StringgetRemoteTrackingBranch()Get the full remote-tracking branch namejava.lang.StringgetTrackingBranch()Get the full tracking branch namebooleanisRebase()Whether the branch is configured to be rebasedbooleanisRemoteLocal()Whether the "remote" setting points to the local repository (with ".")
-
-
-
Field Detail
-
LOCAL_REPOSITORY
public static final java.lang.String LOCAL_REPOSITORY
The value that means "local repository" forgetRemote(): "."- Since:
- 3.5
- See Also:
- Constant Field Values
-
config
private final Config config
-
branchName
private final java.lang.String branchName
-
-
Constructor Detail
-
BranchConfig
public BranchConfig(Config config, java.lang.String branchName)
Create a new branch config, which will read configuration from config about specified branch.- Parameters:
config- the config to read frombranchName- the short branch name of the section to read
-
-
Method Detail
-
getTrackingBranch
public java.lang.String getTrackingBranch()
Get the full tracking branch name- Returns:
- the full tracking branch name or
nullif it could not be determined
-
getRemoteTrackingBranch
public java.lang.String getRemoteTrackingBranch()
Get the full remote-tracking branch name- Returns:
- the full remote-tracking branch name or
nullif it could not be determined. If you also want local tracked branches usegetTrackingBranch()instead.
-
isRemoteLocal
public boolean isRemoteLocal()
Whether the "remote" setting points to the local repository (with ".")- Returns:
trueif the "remote" setting points to the local repository (with "."), false otherwise- Since:
- 3.5
-
getRemote
public java.lang.String getRemote()
Get the remote this branch is configured to fetch from/push to- Returns:
- the remote this branch is configured to fetch from/push to, or
nullif not defined - Since:
- 3.5
-
getMerge
public java.lang.String getMerge()
Get the name of the upstream branch as it is called on the remote- Returns:
- the name of the upstream branch as it is called on the remote, or
nullif not defined - Since:
- 3.5
-
isRebase
public boolean isRebase()
Whether the branch is configured to be rebased- Returns:
trueif the branch is configured to be rebased- Since:
- 3.5
-
getRebaseMode
public BranchConfig.BranchRebaseMode getRebaseMode()
Retrieves the config value of branch.[name].rebase.- Returns:
- the
BranchConfig.BranchRebaseMode - Since:
- 4.5
-
findRemoteTrackingBranch
private java.lang.String findRemoteTrackingBranch(java.lang.String remote, java.lang.String mergeRef)Finds the tracked remote tracking branch- Parameters:
remote- Remote namemergeRef- merge Ref of the local branch tracking the remote tracking branch- Returns:
- full remote tracking branch name or null
-
getRemoteOrDefault
private java.lang.String getRemoteOrDefault()
-
-