import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT;
import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT_ENCODING;
import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE;
+import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
import java.io.IOException;
import java.net.ProxySelector;
// This could be done better (more precise logic), but according
// to https://github.com/git-lfs/git-lfs/issues/1759 git-lfs
// generally only supports 'origin' in an integrated workflow.
- if (lfsUrl == null && (remote.equals(
- org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME))) {
+ if (lfsUrl == null && remote.equals(DEFAULT_REMOTE_NAME)) {
remoteUrl = config.getString(
ConfigConstants.CONFIG_KEY_REMOTE, remote,
ConfigConstants.CONFIG_KEY_URL);
continue;
}
- final URL u = new URL(
- (!s.contains("://")) ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$
+ URL u = new URL(!s.contains("://") ? protocol + "://" + s : s); //$NON-NLS-1$ //$NON-NLS-2$
if (!u.getProtocol().startsWith("http")) //$NON-NLS-1$
throw new MalformedURLException(MessageFormat.format(
CLIText.get().invalidHttpProxyOnlyHttpSupported, s));
firstHeader = false;
}
int nbUntracked = untracked.size();
- if (nbUntracked > 0 && ("all".equals(untrackedFilesMode))) { //$NON-NLS-1$
+ if (nbUntracked > 0 && "all".equals(untrackedFilesMode)) { //$NON-NLS-1$
if (!firstHeader)
printSectionHeader(""); //$NON-NLS-1$
printSectionHeader(CLIText.get().untrackedFiles);
// specified the commit should not be empty. This behaviour differs
// from native git but can only be adapted in the next release.
// TODO(ch) align the defaults with native git
- allowEmpty = (only.isEmpty()) ? Boolean.TRUE : Boolean.FALSE;
+ allowEmpty = only.isEmpty() ? Boolean.TRUE : Boolean.FALSE;
// when doing a merge commit parse MERGE_HEAD and MERGE_MSG files
if (state == RepositoryState.MERGING_RESOLVED
PersonIdent author, RemoteReader callback,
BareWriterConfig config,
List<ExtraContent> extraContents) {
- assert (repo.isBare());
+ assert repo.isBare();
this.repo = repo;
this.targetUri = targetUri;
this.targetBranch = targetBranch;
private void addSubmodule(String name, String url, String path,
String revision, List<CopyFile> copyfiles, List<LinkFile> linkfiles,
Git git) throws GitAPIException, IOException {
- assert (!repo.isBare());
- assert (git != null);
+ assert !repo.isBare();
+ assert git != null;
if (!linkfiles.isEmpty()) {
throw new UnsupportedOperationException(
JGitText.get().nonBareLinkFilesNotSupported);
}
boolean searchPacksAgain(PackList old) {
- return ((!trustFolderStat) || old.snapshot.isModified(directory))
+ return (!trustFolderStat || old.snapshot.isModified(directory))
&& old != scanPacks(old);
}
int b1 = data[pos - 3] & 0xff;
int b2 = data[pos - 2] & 0xff;
int b3 = data[pos - 1] & 0xff;
- return (((long) b0) << 24) | (b1 << 16) | (b2 << 8) | (b3);
+ return (((long) b0) << 24) | (b1 << 16) | (b2 << 8) | b3;
}
@Override
}
}
- int cnt = (int) (Math.ceil(blockLimitBytes / avgBytesPerEntry));
+ int cnt = (int) Math.ceil(blockLimitBytes / avgBytesPerEntry);
return Math.min(cnt, 4096);
}
}
private File getFile(String path) {
- return (inCore()) ? null : new File(repo.getWorkTree(), path);
+ return inCore() ? null : new File(repo.getWorkTree(), path);
}
/* returns null if the path is not found. */
}
File modulesFile = new File(repository.getWorkTree(),
Constants.DOT_GIT_MODULES);
- return (modulesFile.exists());
+ return modulesFile.exists();
}
private void lazyLoadModulesConfig() throws IOException, ConfigInvalidException {
valuePart[0].toUpperCase(Locale.ROOT));
if ((ignoreTypes != null)
- && (ignoreTypes.contains(methodType))) {
+ && ignoreTypes.contains(methodType)) {
continue;
}
private static final int DEFAULT_MAX_REDIRECTS = 5;
- private static final int MAX_REDIRECTS = (new Supplier<Integer>() {
+ private static final int MAX_REDIRECTS = new Supplier<Integer>() {
@Override
public Integer get() {
}
return value;
}
- }).get().intValue();
+ }.get().intValue();
private static final String ENV_HTTP_USER_AGENT = "GIT_HTTP_USER_AGENT"; //$NON-NLS-1$
String commandFor(String exe) {
String path = uri.getPath();
if (uri.getScheme() != null && uri.getPath().startsWith("/~")) //$NON-NLS-1$
- path = (uri.getPath().substring(1));
+ path = uri.getPath().substring(1);
final StringBuilder cmd = new StringBuilder();
cmd.append(exe);
}
return filterCommand.replaceAll("%f", //$NON-NLS-1$
Matcher.quoteReplacement(
- QuotedString.BOURNE.quote((getPathString()))));
+ QuotedString.BOURNE.quote(getPathString())));
}
/**
}
return filterCommand.replaceAll("%f", //$NON-NLS-1$
Matcher.quoteReplacement(
- QuotedString.BOURNE.quote((getPathString()))));
+ QuotedString.BOURNE.quote(getPathString())));
}
/**
link = Files.createLink(
Paths.get(lock.getAbsolutePath() + ".lnk"), //$NON-NLS-1$
lockPath);
- Integer nlink = (Integer) (Files.getAttribute(lockPath,
- "unix:nlink")); //$NON-NLS-1$
+ Integer nlink = (Integer) Files.getAttribute(lockPath,
+ "unix:nlink"); //$NON-NLS-1$
if (nlink > 2) {
LOG.warn(MessageFormat.format(
JGitText.get().failedAtomicFileCreation, lockPath,
return token(true, null);
}
link = Files.createLink(Paths.get(uniqueLinkPath(file)), path);
- Integer nlink = (Integer) (Files.getAttribute(path,
- "unix:nlink")); //$NON-NLS-1$
+ Integer nlink = (Integer) Files.getAttribute(path, "unix:nlink"); //$NON-NLS-1$
if (nlink.intValue() > 2) {
LOG.warn(MessageFormat.format(
JGitText.get().failedAtomicFileCreation, path, nlink));
* @return detected GSSManager factory
*/
public static GSSManagerFactory detect() {
- return (SunGSSManagerFactory.isSupported()) ? new SunGSSManagerFactory()
+ return SunGSSManagerFactory.isSupported() ? new SunGSSManagerFactory()
: new DefaultGSSManagerFactory();
}
private static int s1(int a, int b, int c, int d, int w_t) {
return rotateLeft(a, 5)
// f: 0 <= t <= 19
- + ((b & c) | ((~b) & d))
+ + ((b & c) | (~b & d))
+ 0x5A827999 + w_t;
}