/** * Spawn process * * @param cmd * command * @return a {@link java.lang.Process} object. * @throws org.eclipse.jgit.errors.TransportException * if any. */ protected Process spawn(String cmd) throws TransportException { try { String[] args = { "." }; //$NON-NLS-1$ ProcessBuilder proc = local.getFS().runInShell(cmd, args); proc.directory(remoteGitDir); // Remove the same variables CGit does. Map<String, String> env = proc.environment(); env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$ env.remove("GIT_CONFIG"); //$NON-NLS-1$ env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$ env.remove("GIT_DIR"); //$NON-NLS-1$ env.remove("GIT_WORK_TREE"); //$NON-NLS-1$ env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$ env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$ env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$ return proc.start(); } catch (IOException err) { throw new TransportException(uri, err.getMessage(), err); } }
final String cmd = relativize(runDirectory.getAbsolutePath(), hookPath); ProcessBuilder hookProcess = runInShell(cmd, args); hookProcess.directory(runDirectory); Map<String, String> environment = hookProcess.environment();
CheckoutMetadata checkoutMetadata, ObjectLoader ol, FS fs, OutputStream channel) throws IOException { ProcessBuilder filterProcessBuilder = fs.runInShell( checkoutMetadata.smudgeFilterCommand, new String[0]); filterProcessBuilder.directory(repo.getWorkTree());
ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand, new String[0]); filterProcessBuilder.directory(repository.getWorkTree());
protected Process spawn(final String cmd) throws TransportException { try { String[] args = { "." }; //$NON-NLS-1$ ProcessBuilder proc = local.getFS().runInShell(cmd, args); proc.directory(remoteGitDir); // Remove the same variables CGit does. Map<String, String> env = proc.environment(); env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$ env.remove("GIT_CONFIG"); //$NON-NLS-1$ env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$ env.remove("GIT_DIR"); //$NON-NLS-1$ env.remove("GIT_WORK_TREE"); //$NON-NLS-1$ env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$ env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$ env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$ return proc.start(); } catch (IOException err) { throw new TransportException(uri, err.getMessage(), err); } }
/** * Spawn process * * @param cmd * command * @return a {@link java.lang.Process} object. * @throws org.eclipse.jgit.errors.TransportException * if any. */ protected Process spawn(String cmd) throws TransportException { try { String[] args = { "." }; //$NON-NLS-1$ ProcessBuilder proc = local.getFS().runInShell(cmd, args); proc.directory(remoteGitDir); // Remove the same variables CGit does. Map<String, String> env = proc.environment(); env.remove("GIT_ALTERNATE_OBJECT_DIRECTORIES"); //$NON-NLS-1$ env.remove("GIT_CONFIG"); //$NON-NLS-1$ env.remove("GIT_CONFIG_PARAMETERS"); //$NON-NLS-1$ env.remove("GIT_DIR"); //$NON-NLS-1$ env.remove("GIT_WORK_TREE"); //$NON-NLS-1$ env.remove("GIT_GRAFT_FILE"); //$NON-NLS-1$ env.remove("GIT_INDEX_FILE"); //$NON-NLS-1$ env.remove("GIT_NO_REPLACE_OBJECTS"); //$NON-NLS-1$ return proc.start(); } catch (IOException err) { throw new TransportException(uri, err.getMessage(), err); } }
final String cmd = relativize(runDirectory.getAbsolutePath(), hookPath); ProcessBuilder hookProcess = runInShell(cmd, args); hookProcess.directory(runDirectory); Map<String, String> environment = hookProcess.environment();
final String cmd = relativize(runDirectory.getAbsolutePath(), hookPath); ProcessBuilder hookProcess = runInShell(cmd, args); hookProcess.directory(runDirectory); try {
CheckoutMetadata checkoutMetadata, ObjectLoader ol, FS fs, OutputStream channel) throws IOException { ProcessBuilder filterProcessBuilder = fs.runInShell( checkoutMetadata.smudgeFilterCommand, new String[0]); filterProcessBuilder.directory(repo.getWorkTree());
private InputStream filterClean(InputStream in, OperationType opType) throws IOException { in = handleAutoCRLF(in, opType); String filterCommand = getCleanFilterCommand(); if (filterCommand != null) { FS fs = repository.getFS(); ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand, new String[0]); filterProcessBuilder.directory(repository.getWorkTree()); filterProcessBuilder.environment().put(Constants.GIT_DIR_KEY, repository.getDirectory().getAbsolutePath()); ExecutionResult result; try { result = fs.execute(filterProcessBuilder, in); } catch (IOException | InterruptedException e) { throw new IOException(new FilterFailedException(e, filterCommand, getEntryPathString())); } int rc = result.getRc(); if (rc != 0) { throw new IOException(new FilterFailedException(rc, filterCommand, getEntryPathString(), result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE), RawParseUtils.decode(result.getStderr() .toByteArray(MAX_EXCEPTION_TEXT_SIZE)))); } return result.getStdout().openInputStream(); } return in; }
/** {@inheritDoc} */ @Override public Void call() throws Exception { StoredConfig cfg = null; if (repository == null) { cfg = loadUserConfig(); } else { cfg = repository.getConfig(); } cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_USEJGITBUILTIN, true); cfg.setBoolean(ConfigConstants.CONFIG_FILTER_SECTION, ConfigConstants.CONFIG_SECTION_LFS, ConfigConstants.CONFIG_KEY_REQUIRED, true); cfg.save(); // try to run git lfs install, we really don't care if it is present // and/or works here (yet). ProcessBuilder builder = FS.DETECTED.runInShell("git", //$NON-NLS-1$ repository == null ? ARGS_USER : ARGS_LOCAL); if (repository != null) { builder.directory(repository.isBare() ? repository.getDirectory() : repository.getWorkTree()); } FS.DETECTED.runProcess(builder, null, null, (String) null); return null; }
ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand, new String[0]); filterProcessBuilder.directory(repository.getWorkTree());
new FileOutputStream(tmpFile), nonNullEolStreamType); if (checkoutMetadata.smudgeFilterCommand != null) { ProcessBuilder filterProcessBuilder = fs.runInShell( checkoutMetadata.smudgeFilterCommand, new String[0]); filterProcessBuilder.directory(repo.getWorkTree());