private static boolean useExtSession() { return SystemReader.getInstance().getenv("GIT_SSH") != null; //$NON-NLS-1$ }
/** {@inheritDoc} */ @Override protected File userHomeImpl() { String home = SystemReader.getInstance().getenv("HOME"); //$NON-NLS-1$ if (home != null) return resolve(null, home); String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); //$NON-NLS-1$ if (homeDrive != null) { String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$ if (homePath != null) return new File(homeDrive, homePath); } String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); //$NON-NLS-1$ if (homeShare != null) return new File(homeShare); return super.userHomeImpl(); }
private static String getNameInternal(Config rc, String envKey) { // try to get the user name for the system property GIT_XXX_NAME String username = system().getenv(envKey); if (username == null) { // try to get the user name from the local and global // configurations. username = rc.getString("user", null, "name"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(username); }
private static String getEmailInternal(Config rc, String envKey) { // try to get the email for the system property GIT_XXX_EMAIL String email = system().getenv(envKey); if (email == null) { // try to get the email from the local and global configurations. email = rc.getString("user", null, "email"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(email); }
String val = sr.getenv(GIT_DIR_KEY); if (val != null) setGitDir(new File(val)); String val = sr.getenv(GIT_OBJECT_DIRECTORY_KEY); if (val != null) setObjectDirectory(new File(val)); String val = sr.getenv(GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY); if (val != null) { for (String path : val.split(File.pathSeparator)) String val = sr.getenv(GIT_WORK_TREE_KEY); if (val != null) setWorkTree(new File(val)); String val = sr.getenv(GIT_INDEX_FILE_KEY); if (val != null) setIndexFile(new File(val)); String val = sr.getenv(GIT_CEILING_DIRECTORIES_KEY); if (val != null) { for (String path : val.split(File.pathSeparator))
@Override public Process exec(String command, int timeout) throws TransportException { String ssh = SystemReader.getInstance().getenv("GIT_SSH"); //$NON-NLS-1$ boolean putty = ssh.toLowerCase(Locale.ROOT).contains("plink"); //$NON-NLS-1$ List<String> args = new ArrayList<>(); args.add(ssh); if (putty && !ssh.toLowerCase(Locale.ROOT).contains("tortoiseplink")) //$NON-NLS-1$ args.add("-batch"); //$NON-NLS-1$ if (0 < getURI().getPort()) { args.add(putty ? "-P" : "-p"); //$NON-NLS-1$ //$NON-NLS-2$ args.add(String.valueOf(getURI().getPort())); } if (getURI().getUser() != null) args.add(getURI().getUser() + "@" + getURI().getHost()); //$NON-NLS-1$ else args.add(getURI().getHost()); args.add(command); ProcessBuilder pb = createProcess(args); try { return pb.start(); } catch (IOException err) { throw new TransportException(err.getMessage(), err); } }
/** {@inheritDoc} */ @Override protected File discoverGitExe() { String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ File gitExe = searchPath(path, "git"); //$NON-NLS-1$ if (gitExe == null) { if (SystemReader.getInstance().isMacOS()) { if (searchPath(path, "bash") != null) { //$NON-NLS-1$ // On MacOSX, PATH is shorter when Eclipse is launched from the // Finder than from a terminal. Therefore try to launch bash as a // login shell and search using that. String w; try { w = readPipe(userHome(), new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { gitExe = new File(w); } } } } return gitExe; }
/** {@inheritDoc} */ @Override protected File discoverGitExe() { String path = SystemReader.getInstance().getenv("PATH"); //$NON-NLS-1$ File gitExe = searchPath(path, "git.exe", "git.cmd"); //$NON-NLS-1$ //$NON-NLS-2$ if (gitExe == null) { if (searchPath(path, "bash.exe") != null) { //$NON-NLS-1$ // This isn't likely to work, but its worth trying: // If bash is in $PATH, git should also be in $PATH. String w; try { w = readPipe(userHome(), new String[]{"bash", "--login", "-c", "which git"}, // //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Charset.defaultCharset().name()); } catch (CommandFailedException e) { LOG.warn(e.getMessage()); return null; } if (!StringUtils.isEmptyOrNull(w)) { // The path may be in cygwin/msys notation so resolve it right away gitExe = resolve(null, w); } } } return gitExe; }
private void determineAtomicFileCreationSupport() { // @TODO: enhance SystemReader to support this without copying code AtomicFileCreation ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openUserConfig(null, this)); if (ret == AtomicFileCreation.UNDEFINED && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } supportsAtomicCreateNewFile = ret; }
super(options); if (StringUtils.isEmptyOrNull(SystemReader.getInstance().getenv( Constants.GIT_CONFIG_NOSYSTEM_KEY))) systemConfig = SystemReader.getInstance().openSystemConfig(null,
private static boolean useExtSession() { return SystemReader.getInstance().getenv("GIT_SSH") != null; //$NON-NLS-1$ }
private static boolean useExtSession() { return SystemReader.getInstance().getenv("GIT_SSH") != null; //$NON-NLS-1$ }
private static String calcHomeDir() { if (runsOnWindows()) { String homeDrive = System.getenv("HOMEDRIVE"); //$NON-NLS-1$ if (homeDrive != null) { String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$ return new File(homeDrive, homePath).getAbsolutePath(); } return System.getenv("HOMESHARE"); //$NON-NLS-1$ } else { // The user.home property is not compatible with Git for Windows return System.getProperty("user.home"); //$NON-NLS-1$ } }
@Override protected File userHomeImpl() { String home = SystemReader.getInstance().getenv("HOME"); //$NON-NLS-1$ if (home != null) return resolve(null, home); String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); //$NON-NLS-1$ if (homeDrive != null) { String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$ if (homePath != null) return new File(homeDrive, homePath); } String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); //$NON-NLS-1$ if (homeShare != null) return new File(homeShare); return super.userHomeImpl(); }
/** {@inheritDoc} */ @Override protected File userHomeImpl() { String home = SystemReader.getInstance().getenv("HOME"); //$NON-NLS-1$ if (home != null) return resolve(null, home); String homeDrive = SystemReader.getInstance().getenv("HOMEDRIVE"); //$NON-NLS-1$ if (homeDrive != null) { String homePath = SystemReader.getInstance().getenv("HOMEPATH"); //$NON-NLS-1$ if (homePath != null) return new File(homeDrive, homePath); } String homeShare = SystemReader.getInstance().getenv("HOMESHARE"); //$NON-NLS-1$ if (homeShare != null) return new File(homeShare); return super.userHomeImpl(); }
private static String getEmailInternal(Config rc, String envKey) { // try to get the email for the system property GIT_XXX_EMAIL String email = system().getenv(envKey); if (email == null) { // try to get the email from the local and global configurations. email = rc.getString("user", null, "email"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(email); }
private static String getNameInternal(Config rc, String envKey) { // try to get the user name for the system property GIT_XXX_NAME String username = system().getenv(envKey); if (username == null) { // try to get the user name from the local and global // configurations. username = rc.getString("user", null, "name"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(username); }
private static String getNameInternal(Config rc, String envKey) { // try to get the user name for the system property GIT_XXX_NAME String username = system().getenv(envKey); if (username == null) { // try to get the user name from the local and global // configurations. username = rc.getString("user", null, "name"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(username); }
private static String getEmailInternal(Config rc, String envKey) { // try to get the email for the system property GIT_XXX_EMAIL String email = system().getenv(envKey); if (email == null) { // try to get the email from the local and global configurations. email = rc.getString("user", null, "email"); //$NON-NLS-1$ //$NON-NLS-2$ } return stripInvalidCharacters(email); }
private void determineAtomicFileCreationSupport() { // @TODO: enhance SystemReader to support this without copying code AtomicFileCreation ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openUserConfig(null, this)); if (ret == AtomicFileCreation.UNDEFINED && StringUtils.isEmptyOrNull(SystemReader.getInstance() .getenv(Constants.GIT_CONFIG_NOSYSTEM_KEY))) { ret = getAtomicFileCreationSupportOption( SystemReader.getInstance().openSystemConfig(null, this)); } supportsAtomicCreateNewFile = ret; }