Change-Id: If3cc05931683d396b5ae2ea8952adceeb9a82ab9tags/v3.3.0.201402191814-rc1
import org.eclipse.jgit.lib.StoredConfig; | import org.eclipse.jgit.lib.StoredConfig; | ||||
import org.eclipse.jgit.storage.file.FileBasedConfig; | import org.eclipse.jgit.storage.file.FileBasedConfig; | ||||
import org.eclipse.jgit.util.FS; | import org.eclipse.jgit.util.FS; | ||||
import org.eclipse.jgit.util.StringUtils; | |||||
import org.eclipse.jgit.util.SystemReader; | import org.eclipse.jgit.util.SystemReader; | ||||
import org.kohsuke.args4j.Option; | import org.kohsuke.args4j.Option; | ||||
list(new FileBasedConfig(configFile, fs)); | list(new FileBasedConfig(configFile, fs)); | ||||
return; | return; | ||||
} | } | ||||
if (system || isListAll()) | |||||
if (system | |||||
|| (isListAll() && StringUtils.isEmptyOrNull(SystemReader | |||||
.getInstance() | |||||
.getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY)))) | |||||
list(SystemReader.getInstance().openSystemConfig(null, fs)); | list(SystemReader.getInstance().openSystemConfig(null, fs)); | ||||
if (global || isListAll()) | if (global || isListAll()) | ||||
list(SystemReader.getInstance().openUserConfig(null, fs)); | list(SystemReader.getInstance().openUserConfig(null, fs)); |
import org.eclipse.jgit.lib.Repository; | import org.eclipse.jgit.lib.Repository; | ||||
import org.eclipse.jgit.storage.file.FileBasedConfig; | import org.eclipse.jgit.storage.file.FileBasedConfig; | ||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder; | import org.eclipse.jgit.storage.file.FileRepositoryBuilder; | ||||
import org.eclipse.jgit.util.FS; | |||||
import org.eclipse.jgit.util.FileUtils; | import org.eclipse.jgit.util.FileUtils; | ||||
import org.eclipse.jgit.util.StringUtils; | |||||
import org.eclipse.jgit.util.SystemReader; | import org.eclipse.jgit.util.SystemReader; | ||||
/** | /** | ||||
public FileRepository(final BaseRepositoryBuilder options) throws IOException { | public FileRepository(final BaseRepositoryBuilder options) throws IOException { | ||||
super(options); | super(options); | ||||
systemConfig = SystemReader.getInstance().openSystemConfig(null, getFS()); | |||||
if (StringUtils.isEmptyOrNull(SystemReader.getInstance().getenv( | |||||
Constants.GIT_CONFIG_NOSYSTEM_KEY))) | |||||
systemConfig = SystemReader.getInstance().openSystemConfig(null, | |||||
getFS()); | |||||
else | |||||
systemConfig = new FileBasedConfig(null, FS.DETECTED) { | |||||
public void load() { | |||||
// empty, do not load | |||||
} | |||||
public boolean isOutdated() { | |||||
// regular class would bomb here | |||||
return false; | |||||
} | |||||
}; | |||||
userConfig = SystemReader.getInstance().openUserConfig(systemConfig, | userConfig = SystemReader.getInstance().openUserConfig(systemConfig, | ||||
getFS()); | getFS()); | ||||
repoConfig = new FileBasedConfig(userConfig, getFS().resolve( | repoConfig = new FileBasedConfig(userConfig, getFS().resolve( |
/** The environment variable that contains the commiter's email */ | /** The environment variable that contains the commiter's email */ | ||||
public static final String GIT_COMMITTER_EMAIL_KEY = "GIT_COMMITTER_EMAIL"; | public static final String GIT_COMMITTER_EMAIL_KEY = "GIT_COMMITTER_EMAIL"; | ||||
/** The environment variable that blocks use of the system config file */ | |||||
public static final String GIT_CONFIG_NOSYSTEM_KEY = "GIT_CONFIG_NOSYSTEM"; | |||||
/** | /** | ||||
* The environment variable that limits how close to the root of the file | * The environment variable that limits how close to the root of the file | ||||
* systems JGit will traverse when looking for a repository root. | * systems JGit will traverse when looking for a repository root. |