private static SystemReader system() { return SystemReader.getInstance(); } }
/** {@inheritDoc} */ @Override public boolean isCaseSensitive() { return !SystemReader.getInstance().isMacOS(); }
private static SimpleDateFormat getNewSimpleDateFormat( ParseableSimpleDateFormat f, Locale locale, Map<ParseableSimpleDateFormat, SimpleDateFormat> map) { SimpleDateFormat df = SystemReader.getInstance().getSimpleDateFormat( f.formatStr, locale); map.put(f, df); return df; }
@Override public String run() { return SystemReader.getInstance() .getProperty(Constants.OS_USER_NAME_KEY); } });
/** * Construct a new {@link org.eclipse.jgit.lib.PersonIdent} with current * time. * * @param aName * a {@link java.lang.String} object. * @param aEmailAddress * a {@link java.lang.String} object. */ public PersonIdent(String aName, String aEmailAddress) { this(aName, aEmailAddress, SystemReader.getInstance().getCurrentTime()); }
private PersonIdent(final String aName, final String aEmailAddress, long when) { this(aName, aEmailAddress, when, SystemReader.getInstance() .getTimezone(when)); }
private static long dayStartInMillis(long timeInMillis) { Calendar cal = new GregorianCalendar( SystemReader.getInstance().getTimeZone()); cal.setTimeInMillis(timeInMillis); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTimeInMillis(); }
@Override public String run() { return SystemReader.getInstance().getProperty("line.separator"); //$NON-NLS-1$ } });
/** * Read standard Git environment variables and configure from those. * <p> * This method tries to read the standard Git environment variables, such as * {@code GIT_DIR} and {@code GIT_WORK_TREE} to configure this builder * instance. If an environment variable is set, it overrides the value * already set in this builder. * * @return {@code this} (for chaining calls). */ public B readEnvironment() { return readEnvironment(SystemReader.getInstance()); }
private static boolean useExtSession() { return SystemReader.getInstance().getenv("GIT_SSH") != null; //$NON-NLS-1$ }
/** * On Mac: get NFC normalized form of given name, otherwise the given name. * * @param name * a {@link java.lang.String} object. * @return on Mac: NFC normalized form of given name * @since 4.1 */ public static String normalize(String name) { if (SystemReader.getInstance().isMacOS()) { if (name == null) return null; return Normalizer.normalize(name, Normalizer.Form.NFC); } return name; }
/** {@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 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; }
@Override public Integer get() { String rawValue = SystemReader.getInstance() .getProperty(MAX_REDIRECT_SYSTEM_PROPERTY); Integer value = Integer.valueOf(DEFAULT_MAX_REDIRECTS); if (rawValue != null) { try { value = Integer.valueOf(Integer.parseUnsignedInt(rawValue)); } catch (NumberFormatException e) { LOG.warn(MessageFormat.format( JGitText.get().invalidSystemProperty, MAX_REDIRECT_SYSTEM_PROPERTY, rawValue, value)); } } return value; } }).get().intValue();
private long getExpireDate() throws ParseException { long expireDate = Long.MAX_VALUE; if (expire == null && expireAgeMillis == -1) { String pruneExpireStr = getPruneExpireStr(); if (pruneExpireStr == null) pruneExpireStr = PRUNE_EXPIRE_DEFAULT; expire = GitDateParser.parse(pruneExpireStr, null, SystemReader .getInstance().getLocale()); expireAgeMillis = -1; } if (expire != null) expireDate = expire.getTime(); if (expireAgeMillis != -1) expireDate = System.currentTimeMillis() - expireAgeMillis; return expireDate; }
private void updateSslVerifyUser(boolean value) { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); try { userConfig.load(); updateSslVerify(userConfig, value); } catch (IOException | ConfigInvalidException e) { // Log it, but otherwise ignore here. LOG.error(MessageFormat.format(JGitText.get().userConfigFileInvalid, userConfig.getFile().getAbsolutePath(), e)); } }
private void readPacksBefore() throws IOException { DfsPackFile[] packs = objdb.getPacks(); packsBefore = new ArrayList<>(packs.length); expiredGarbagePacks = new ArrayList<>(packs.length); long now = SystemReader.getInstance().getCurrentTime(); for (DfsPackFile p : packs) { DfsPackDescription d = p.getPackDescription(); if (d.getPackSource() != UNREACHABLE_GARBAGE) { packsBefore.add(p); } else if (packIsExpiredGarbage(d, now)) { expiredGarbagePacks.add(p); } else if (packIsCoalesceableGarbage(d, now)) { packsBefore.add(p); } } }
private Instant getLogExpiry() throws ParseException { if (gcLogExpire == null) { String logExpiryStr = repo.getConfig().getString( ConfigConstants.CONFIG_GC_SECTION, null, ConfigConstants.CONFIG_KEY_LOGEXPIRY); if (logExpiryStr == null) { logExpiryStr = LOG_EXPIRY_DEFAULT; } gcLogExpire = GitDateParser.parse(logExpiryStr, null, SystemReader.getInstance().getLocale()).toInstant(); } return gcLogExpire; }
@SuppressWarnings("deprecation") private static void checkValidPath(CanonicalTreeParser t) throws InvalidPathException { ObjectChecker chk = new ObjectChecker() .setSafeForWindows(SystemReader.getInstance().isWindows()) .setSafeForMacOS(SystemReader.getInstance().isMacOS()); for (CanonicalTreeParser i = t; i != null; i = i.getParent()) checkValidPathSegment(chk, i); }
private static void checkPath(byte[] path) { try { SystemReader.getInstance().checkPath(path); } catch (CorruptObjectException e) { InvalidPathException p = new InvalidPathException(toString(path)); p.initCause(e); throw p; } }