Remove 'final' in parameter lists
Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
This commit is contained in:
parent
f6873ffe52
commit
6d370d837c
|
@ -421,7 +421,7 @@ public void connect() throws IOException {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void setHostnameVerifier(final HostnameVerifier hostnameverifier) {
|
||||
public void setHostnameVerifier(HostnameVerifier hostnameverifier) {
|
||||
this.hostnameverifier = hostnameverifier;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ private boolean initRangeRequest(final HttpServletRequest req,
|
|||
return true;
|
||||
}
|
||||
|
||||
private static Enumeration<String> getRange(final HttpServletRequest req) {
|
||||
private static Enumeration<String> getRange(HttpServletRequest req) {
|
||||
return req.getHeaders(HDR_RANGE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ public void addReceivePackFilter(Filter filter) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void init(final ServletConfig config) throws ServletException {
|
||||
public void init(ServletConfig config) throws ServletException {
|
||||
gitFilter.init(new FilterConfig() {
|
||||
@Override
|
||||
public String getFilterName() {
|
||||
|
|
|
@ -67,7 +67,7 @@ public void doGet(final HttpServletRequest req,
|
|||
sendPlainText(packList(req), req, rsp);
|
||||
}
|
||||
|
||||
private static String packList(final HttpServletRequest req) {
|
||||
private static String packList(HttpServletRequest req) {
|
||||
final StringBuilder out = new StringBuilder();
|
||||
final ObjectDatabase db = getRepository(req).getObjectDatabase();
|
||||
if (db instanceof ObjectDirectory) {
|
||||
|
|
|
@ -79,7 +79,7 @@ public void doGet(final HttpServletRequest req,
|
|||
Constants.CHARSET)) {
|
||||
final RefAdvertiser adv = new RefAdvertiser() {
|
||||
@Override
|
||||
protected void writeOne(final CharSequence line)
|
||||
protected void writeOne(CharSequence line)
|
||||
throws IOException {
|
||||
// Whoever decided that info/refs should use a different
|
||||
// delimiter than the native git:// protocol shouldn't
|
||||
|
|
|
@ -88,7 +88,7 @@ public void doFilter(ServletRequest request, ServletResponse response,
|
|||
((HttpServletResponse) response).sendError(SC_FORBIDDEN);
|
||||
}
|
||||
|
||||
private static boolean isLocal(final Repository db) {
|
||||
private static boolean isLocal(Repository db) {
|
||||
return db.getObjectDatabase() instanceof ObjectDirectory;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ private void serve(final HttpServletRequest req,
|
|||
}
|
||||
}
|
||||
|
||||
private static File objects(final HttpServletRequest req) {
|
||||
private static File objects(HttpServletRequest req) {
|
||||
final Repository db = getRepository(req);
|
||||
return ((ObjectDirectory) db.getObjectDatabase()).getDirectory();
|
||||
}
|
||||
|
|
|
@ -100,13 +100,13 @@ public class RepositoryFilter implements Filter {
|
|||
* {@link org.eclipse.jgit.lib.Repository} instance for the
|
||||
* current web request.
|
||||
*/
|
||||
public RepositoryFilter(final RepositoryResolver<HttpServletRequest> resolver) {
|
||||
public RepositoryFilter(RepositoryResolver<HttpServletRequest> resolver) {
|
||||
this.resolver = resolver;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void init(final FilterConfig config) throws ServletException {
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
context = config.getServletContext();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public final class ServletUtils {
|
|||
* the filter runs before the servlet.
|
||||
* @see #ATTRIBUTE_REPOSITORY
|
||||
*/
|
||||
public static Repository getRepository(final ServletRequest req) {
|
||||
public static Repository getRepository(ServletRequest req) {
|
||||
Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY);
|
||||
if (db == null)
|
||||
throw new IllegalStateException(HttpServerText.get().expectedRepositoryAttribute);
|
||||
|
@ -110,7 +110,7 @@ public static Repository getRepository(final ServletRequest req) {
|
|||
* @throws IOException
|
||||
* if an input or output exception occurred.
|
||||
*/
|
||||
public static InputStream getInputStream(final HttpServletRequest req)
|
||||
public static InputStream getInputStream(HttpServletRequest req)
|
||||
throws IOException {
|
||||
InputStream in = req.getInputStream();
|
||||
final String enc = req.getHeader(HDR_CONTENT_ENCODING);
|
||||
|
@ -258,7 +258,7 @@ static boolean acceptsGzipEncoding(String accepts) {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static byte[] compress(final byte[] raw) throws IOException {
|
||||
private static byte[] compress(byte[] raw) throws IOException {
|
||||
final int maxLen = raw.length + 32;
|
||||
final ByteArrayOutputStream out = new ByteArrayOutputStream(maxLen);
|
||||
final GZIPOutputStream gz = new GZIPOutputStream(out);
|
||||
|
@ -268,7 +268,7 @@ private static byte[] compress(final byte[] raw) throws IOException {
|
|||
return out.toByteArray();
|
||||
}
|
||||
|
||||
private static String etag(final byte[] content) {
|
||||
private static String etag(byte[] content) {
|
||||
final MessageDigest md = Constants.newMessageDigest();
|
||||
md.update(content);
|
||||
return ObjectId.fromRaw(md.digest()).getName();
|
||||
|
|
|
@ -80,7 +80,7 @@ public void doGet(final HttpServletRequest req,
|
|||
}
|
||||
}
|
||||
|
||||
private byte[] read(final HttpServletRequest req) throws IOException {
|
||||
private byte[] read(HttpServletRequest req) throws IOException {
|
||||
final File gitdir = getRepository(req).getDirectory();
|
||||
if (gitdir == null)
|
||||
throw new FileNotFoundException(fileName);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ErrorServlet extends HttpServlet {
|
|||
* @param status
|
||||
* the HTTP status code to always send.
|
||||
*/
|
||||
public ErrorServlet(final int status) {
|
||||
public ErrorServlet(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RegexGroupFilter implements Filter {
|
|||
* @param groupIdx
|
||||
* capture group number, 1 through the number of groups.
|
||||
*/
|
||||
public RegexGroupFilter(final int groupIdx) {
|
||||
public RegexGroupFilter(int groupIdx) {
|
||||
if (groupIdx < 1)
|
||||
throw new IllegalArgumentException(MessageFormat.format(
|
||||
HttpServerText.get().invalidIndex, valueOf(groupIdx)));
|
||||
|
@ -108,7 +108,7 @@ public void doFilter(final ServletRequest request,
|
|||
valueOf(groupIdx + 1)));
|
||||
}
|
||||
|
||||
private static WrappedRequest[] groupsFor(final ServletRequest r) {
|
||||
private static WrappedRequest[] groupsFor(ServletRequest r) {
|
||||
return (WrappedRequest[]) r.getAttribute(MetaFilter.REGEX_GROUPS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ private static class ServiceConfig {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public ReceivePack create(final HttpServletRequest req, final Repository db)
|
||||
public ReceivePack create(HttpServletRequest req, Repository db)
|
||||
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
|
||||
final ServiceConfig cfg = db.getConfig().get(ServiceConfig::new);
|
||||
String user = req.getRemoteUser();
|
||||
|
|
|
@ -71,7 +71,7 @@ private static class ServiceConfig {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public UploadPack create(final HttpServletRequest req, final Repository db)
|
||||
public UploadPack create(HttpServletRequest req, Repository db)
|
||||
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
|
||||
if (db.getConfig().get(ServiceConfig::new).enabled)
|
||||
return new UploadPack(db);
|
||||
|
|
|
@ -118,7 +118,7 @@ public void setUp() throws Exception {
|
|||
smartAuthBasicURI = toURIish(sBasic, srcName);
|
||||
}
|
||||
|
||||
private ServletContextHandler dumb(final String path) {
|
||||
private ServletContextHandler dumb(String path) {
|
||||
final File srcGit = remoteRepository.getRepository().getDirectory();
|
||||
final URI base = srcGit.getParentFile().toURI();
|
||||
|
||||
|
@ -130,7 +130,7 @@ private ServletContextHandler dumb(final String path) {
|
|||
return ctx;
|
||||
}
|
||||
|
||||
private ServletContextHandler smart(final String path) {
|
||||
private ServletContextHandler smart(String path) {
|
||||
GitServlet gs = new GitServlet();
|
||||
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
|
||||
@Override
|
||||
|
@ -151,7 +151,7 @@ public Repository open(HttpServletRequest req, String name)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
private static String nameOf(final Repository db) {
|
||||
private static String nameOf(Repository db) {
|
||||
return db.getDirectory().getName();
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class AccessEvent {
|
|||
responseHeaders = cloneHeaders(rsp);
|
||||
}
|
||||
|
||||
private static Map<String, String> cloneHeaders(final Request req) {
|
||||
private static Map<String, String> cloneHeaders(Request req) {
|
||||
Map<String, String> r = new TreeMap<>();
|
||||
Enumeration hn = req.getHeaderNames();
|
||||
while (hn.hasMoreElements()) {
|
||||
|
@ -89,7 +89,7 @@ private static Map<String, String> cloneHeaders(final Request req) {
|
|||
return Collections.unmodifiableMap(r);
|
||||
}
|
||||
|
||||
private static Map<String, String> cloneHeaders(final Response rsp) {
|
||||
private static Map<String, String> cloneHeaders(Response rsp) {
|
||||
Map<String, String> r = new TreeMap<>();
|
||||
Enumeration<String> hn = rsp.getHttpFields().getFieldNames();
|
||||
while (hn.hasMoreElements()) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public RecordingLogger() {
|
|||
*
|
||||
* @param name
|
||||
*/
|
||||
public RecordingLogger(final String name) {
|
||||
public RecordingLogger(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public URIish getSecureUri() {
|
|||
return secureUri;
|
||||
}
|
||||
|
||||
private ServletContextHandler smart(final String path) {
|
||||
private ServletContextHandler smart(String path) {
|
||||
GitServlet gs = new GitServlet();
|
||||
gs.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>() {
|
||||
@Override
|
||||
|
@ -154,7 +154,7 @@ public Repository open(HttpServletRequest req, String name)
|
|||
return ctx;
|
||||
}
|
||||
|
||||
private static String nameOf(final Repository db) {
|
||||
private static String nameOf(Repository db) {
|
||||
return db.getDirectory().getName();
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ private static String s(byte[] raw) {
|
|||
* @param fileName
|
||||
* @return the test resource file
|
||||
*/
|
||||
public static File getTestResourceFile(final String fileName) {
|
||||
public static File getTestResourceFile(String fileName) {
|
||||
if (fileName == null || fileName.length() <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ public static File writeTrashFile(final Repository db,
|
|||
* @throws IOException
|
||||
* the file could not be written.
|
||||
*/
|
||||
public static void write(final File f, final String body)
|
||||
public static void write(File f, String body)
|
||||
throws IOException {
|
||||
FileUtils.mkdirs(f.getParentFile(), true);
|
||||
try (Writer w = new OutputStreamWriter(new FileOutputStream(f),
|
||||
|
@ -261,7 +261,7 @@ public static void write(final File f, final String body)
|
|||
* @throws IOException
|
||||
* the file does not exist, or could not be read.
|
||||
*/
|
||||
public static String read(final File file) throws IOException {
|
||||
public static String read(File file) throws IOException {
|
||||
final byte[] body = IO.readFully(file);
|
||||
return new String(body, 0, body.length, CHARSET);
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public static String read(final File file) throws IOException {
|
|||
* @return the content of the file
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String read(final Repository db, final String name)
|
||||
public static String read(Repository db, String name)
|
||||
throws IOException {
|
||||
File file = new File(db.getWorkTree(), name);
|
||||
return read(file);
|
||||
|
@ -288,7 +288,7 @@ public static String read(final Repository db, final String name)
|
|||
* name of the file
|
||||
* @return {@code true} if the file exists
|
||||
*/
|
||||
public static boolean check(final Repository db, final String name) {
|
||||
public static boolean check(Repository db, String name) {
|
||||
File file = new File(db.getWorkTree(), name);
|
||||
return file.exists();
|
||||
}
|
||||
|
|
|
@ -225,7 +225,7 @@ protected void tick() {
|
|||
* @param dir
|
||||
* the recursively directory to delete, if present.
|
||||
*/
|
||||
protected void recursiveDelete(final File dir) {
|
||||
protected void recursiveDelete(File dir) {
|
||||
recursiveDelete(dir, false, true);
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ private static void putPersonIdent(final Map<String, String> env,
|
|||
* @throws IOException
|
||||
* the file could not be written.
|
||||
*/
|
||||
protected File write(final String body) throws IOException {
|
||||
protected File write(String body) throws IOException {
|
||||
final File f = File.createTempFile("temp", "txt", tmp);
|
||||
try {
|
||||
write(f, body);
|
||||
|
@ -571,7 +571,7 @@ protected File write(final String body) throws IOException {
|
|||
* @throws IOException
|
||||
* the file could not be written.
|
||||
*/
|
||||
protected void write(final File f, final String body) throws IOException {
|
||||
protected void write(File f, String body) throws IOException {
|
||||
JGitTestUtil.write(f, body);
|
||||
}
|
||||
|
||||
|
@ -583,11 +583,11 @@ protected void write(final File f, final String body) throws IOException {
|
|||
* @return the content of the file
|
||||
* @throws IOException
|
||||
*/
|
||||
protected String read(final File f) throws IOException {
|
||||
protected String read(File f) throws IOException {
|
||||
return JGitTestUtil.read(f);
|
||||
}
|
||||
|
||||
private static String[] toEnvArray(final Map<String, String> env) {
|
||||
private static String[] toEnvArray(Map<String, String> env) {
|
||||
final String[] envp = new String[env.size()];
|
||||
int i = 0;
|
||||
for (Map.Entry<String, String> e : env.entrySet())
|
||||
|
|
|
@ -109,7 +109,7 @@ public MockSystemReader() {
|
|||
setCurrentPlatform();
|
||||
}
|
||||
|
||||
private void init(final String n) {
|
||||
private void init(String n) {
|
||||
setProperty(n, n);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public void blockUntil(Duration maxWait) {
|
|||
* number of seconds to add to the current time.
|
||||
* @since 4.2
|
||||
*/
|
||||
public void tick(final int secDelta) {
|
||||
public void tick(int secDelta) {
|
||||
now += secDelta * 1000L;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public abstract class RepositoryTestCase extends LocalDiskRepositoryTestCase {
|
|||
* @param dst
|
||||
* @throws IOException
|
||||
*/
|
||||
protected static void copyFile(final File src, final File dst)
|
||||
protected static void copyFile(File src, File dst)
|
||||
throws IOException {
|
||||
try (FileInputStream fis = new FileInputStream(src);
|
||||
FileOutputStream fos = new FileOutputStream(dst)) {
|
||||
|
@ -112,7 +112,7 @@ protected static void copyFile(final File src, final File dst)
|
|||
* @return the trash file
|
||||
* @throws IOException
|
||||
*/
|
||||
protected File writeTrashFile(final String name, final String data)
|
||||
protected File writeTrashFile(String name, String data)
|
||||
throws IOException {
|
||||
return JGitTestUtil.writeTrashFile(db, name, data);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ protected File writeTrashFile(final String name, final String data)
|
|||
* @throws Exception
|
||||
* @since 4.2
|
||||
*/
|
||||
protected Path writeLink(final String link, final String target)
|
||||
protected Path writeLink(String link, String target)
|
||||
throws Exception {
|
||||
return JGitTestUtil.writeLink(db, link, target);
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ protected File writeTrashFile(final String subdir, final String name,
|
|||
* @return the file's content
|
||||
* @throws IOException
|
||||
*/
|
||||
protected String read(final String name) throws IOException {
|
||||
protected String read(String name) throws IOException {
|
||||
return JGitTestUtil.read(db, name);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ protected String read(final String name) throws IOException {
|
|||
* file name
|
||||
* @return if the file exists
|
||||
*/
|
||||
protected boolean check(final String name) {
|
||||
protected boolean check(String name) {
|
||||
return JGitTestUtil.check(db, name);
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ protected boolean check(final String name) {
|
|||
* file name
|
||||
* @throws IOException
|
||||
*/
|
||||
protected void deleteTrashFile(final String name) throws IOException {
|
||||
protected void deleteTrashFile(String name) throws IOException {
|
||||
JGitTestUtil.deleteTrashFile(db, name);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ protected void deleteTrashFile(final String name) throws IOException {
|
|||
* expected content
|
||||
* @throws IOException
|
||||
*/
|
||||
protected static void checkFile(File f, final String checkData)
|
||||
protected static void checkFile(File f, String checkData)
|
||||
throws IOException {
|
||||
try (Reader r = new InputStreamReader(new FileInputStream(f),
|
||||
CHARSET)) {
|
||||
|
@ -500,7 +500,7 @@ else if (empty)
|
|||
* @param mode
|
||||
* @return the DirCacheEntry
|
||||
*/
|
||||
protected DirCacheEntry createEntry(final String path, final FileMode mode) {
|
||||
protected DirCacheEntry createEntry(String path, FileMode mode) {
|
||||
return createEntry(path, mode, DirCacheEntry.STAGE_0, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ public TimeZone getTimeZone() {
|
|||
* @param secDelta
|
||||
* number of seconds to add to the current time.
|
||||
*/
|
||||
public void tick(final int secDelta) {
|
||||
public void tick(int secDelta) {
|
||||
mockSystemReader.tick(secDelta);
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public void setAuthorAndCommitter(org.eclipse.jgit.lib.CommitBuilder c) {
|
|||
* @return reference to the blob.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevBlob blob(final String content) throws Exception {
|
||||
public RevBlob blob(String content) throws Exception {
|
||||
return blob(content.getBytes(CHARSET));
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ public RevBlob blob(final String content) throws Exception {
|
|||
* @return reference to the blob.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevBlob blob(final byte[] content) throws Exception {
|
||||
public RevBlob blob(byte[] content) throws Exception {
|
||||
ObjectId id;
|
||||
try (ObjectInserter ins = inserter) {
|
||||
id = ins.insert(Constants.OBJ_BLOB, content);
|
||||
|
@ -298,7 +298,7 @@ public RevBlob blob(final byte[] content) throws Exception {
|
|||
* @return the entry.
|
||||
* @throws Exception
|
||||
*/
|
||||
public DirCacheEntry file(final String path, final RevBlob blob)
|
||||
public DirCacheEntry file(String path, RevBlob blob)
|
||||
throws Exception {
|
||||
final DirCacheEntry e = new DirCacheEntry(path);
|
||||
e.setFileMode(FileMode.REGULAR_FILE);
|
||||
|
@ -315,7 +315,7 @@ public DirCacheEntry file(final String path, final RevBlob blob)
|
|||
* @return reference to the tree specified by the entry list.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevTree tree(final DirCacheEntry... entries) throws Exception {
|
||||
public RevTree tree(DirCacheEntry... entries) throws Exception {
|
||||
final DirCache dc = DirCache.newInCore();
|
||||
final DirCacheBuilder b = dc.builder();
|
||||
for (final DirCacheEntry e : entries)
|
||||
|
@ -339,7 +339,7 @@ public RevTree tree(final DirCacheEntry... entries) throws Exception {
|
|||
* @return the parsed object entry at this path, never null.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevObject get(final RevTree tree, final String path)
|
||||
public RevObject get(RevTree tree, String path)
|
||||
throws Exception {
|
||||
try (TreeWalk tw = new TreeWalk(pool.getObjectReader())) {
|
||||
tw.setFilter(PathFilterGroup.createFromStrings(Collections
|
||||
|
@ -370,7 +370,7 @@ public RevObject get(final RevTree tree, final String path)
|
|||
* @return the new commit.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevCommit commit(final RevCommit... parents) throws Exception {
|
||||
public RevCommit commit(RevCommit... parents) throws Exception {
|
||||
return commit(1, tree(), parents);
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ public RevCommit commit(final RevCommit... parents) throws Exception {
|
|||
* @return the new commit.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevCommit commit(final RevTree tree, final RevCommit... parents)
|
||||
public RevCommit commit(RevTree tree, RevCommit... parents)
|
||||
throws Exception {
|
||||
return commit(1, tree, parents);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ public RevCommit commit(final RevTree tree, final RevCommit... parents)
|
|||
* @return the new commit.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevCommit commit(final int secDelta, final RevCommit... parents)
|
||||
public RevCommit commit(int secDelta, RevCommit... parents)
|
||||
throws Exception {
|
||||
return commit(secDelta, tree(), parents);
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ public CommitBuilder commit() {
|
|||
* @return the annotated tag object.
|
||||
* @throws Exception
|
||||
*/
|
||||
public RevTag tag(final String name, final RevObject dst) throws Exception {
|
||||
public RevTag tag(String name, RevObject dst) throws Exception {
|
||||
final TagBuilder t = new TagBuilder();
|
||||
t.setObjectId(dst);
|
||||
t.setTag(name);
|
||||
|
@ -759,7 +759,7 @@ public void updateServerInfo() throws Exception {
|
|||
final FileRepository fr = (FileRepository) db;
|
||||
RefWriter rw = new RefWriter(fr.getAllRefs().values()) {
|
||||
@Override
|
||||
protected void writeFile(final String name, final byte[] bin)
|
||||
protected void writeFile(String name, byte[] bin)
|
||||
throws IOException {
|
||||
File path = new File(fr.getDirectory(), name);
|
||||
TestRepository.this.writeFile(path, bin);
|
||||
|
@ -791,7 +791,7 @@ protected void writeFile(final String name, final byte[] bin)
|
|||
* @return {@code object}
|
||||
* @throws Exception
|
||||
*/
|
||||
public <T extends RevObject> T parseBody(final T object) throws Exception {
|
||||
public <T extends RevObject> T parseBody(T object) throws Exception {
|
||||
pool.parseBody(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ private static File nameFor(ObjectDirectory odb, ObjectId name, String t) {
|
|||
return new File(packdir, "pack-" + name.name() + t);
|
||||
}
|
||||
|
||||
private void writeFile(final File p, final byte[] bin) throws IOException,
|
||||
private void writeFile(File p, byte[] bin) throws IOException,
|
||||
ObjectWritingException {
|
||||
final LockFile lck = new LockFile(p);
|
||||
if (!lck.lock())
|
||||
|
@ -1093,7 +1093,7 @@ public CommitBuilder add(String path, String content) throws Exception {
|
|||
return add(path, blob(content));
|
||||
}
|
||||
|
||||
public CommitBuilder add(String path, final RevBlob id)
|
||||
public CommitBuilder add(String path, RevBlob id)
|
||||
throws Exception {
|
||||
return edit(new PathEdit(path) {
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,7 @@ public class TestRng {
|
|||
* @param seed
|
||||
* seed to bootstrap, usually this is the test method name.
|
||||
*/
|
||||
public TestRng(final String seed) {
|
||||
public TestRng(String seed) {
|
||||
next = 0;
|
||||
for (int i = 0; i < seed.length(); i++)
|
||||
next = next * 11 + seed.charAt(i);
|
||||
|
@ -68,7 +68,7 @@ public TestRng(final String seed) {
|
|||
* number of random bytes to produce.
|
||||
* @return array of {@code cnt} randomly generated bytes.
|
||||
*/
|
||||
public byte[] nextBytes(final int cnt) {
|
||||
public byte[] nextBytes(int cnt) {
|
||||
final byte[] r = new byte[cnt];
|
||||
for (int i = 0; i < cnt; i++)
|
||||
r[i] = (byte) nextInt();
|
||||
|
|
|
@ -170,7 +170,7 @@ private static char[] toHexCharArray(int b) {
|
|||
private static final char[] hexchar = { '0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
private static void formatHexChar(final char[] dst, final int p, int b) {
|
||||
private static void formatHexChar(char[] dst, int p, int b) {
|
||||
int o = p + 1;
|
||||
while (o >= p && b != 0) {
|
||||
dst[o--] = hexchar[b & 0xf];
|
||||
|
|
|
@ -78,7 +78,7 @@ public final class AbbreviatedLongObjectId implements Serializable {
|
|||
* the string to test.
|
||||
* @return true if the string can converted into an AbbreviatedObjectId.
|
||||
*/
|
||||
public static final boolean isId(final String id) {
|
||||
public static final boolean isId(String id) {
|
||||
if (id.length() < 2
|
||||
|| Constants.LONG_OBJECT_ID_STRING_LENGTH < id.length())
|
||||
return false;
|
||||
|
@ -138,7 +138,7 @@ public static final AbbreviatedLongObjectId fromLongObjectId(
|
|||
* the string to read from. Must be <= 64 characters.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final AbbreviatedLongObjectId fromString(final String str) {
|
||||
public static final AbbreviatedLongObjectId fromString(String str) {
|
||||
if (str.length() > Constants.LONG_OBJECT_ID_STRING_LENGTH)
|
||||
throw new IllegalArgumentException(
|
||||
MessageFormat.format(LfsText.get().invalidLongId, str));
|
||||
|
@ -249,7 +249,7 @@ public LongObjectId toLongObjectId() {
|
|||
* >0 if this abbreviation names an object that is after
|
||||
* <code>other</code>.
|
||||
*/
|
||||
public final int prefixCompare(final AnyLongObjectId other) {
|
||||
public final int prefixCompare(AnyLongObjectId other) {
|
||||
int cmp;
|
||||
|
||||
cmp = NB.compareUInt64(w1, mask(1, other.w1));
|
||||
|
@ -281,7 +281,7 @@ public final int prefixCompare(final AnyLongObjectId other) {
|
|||
* >0 if this abbreviation names an object that is after
|
||||
* <code>other</code>.
|
||||
*/
|
||||
public final int prefixCompare(final byte[] bs, final int p) {
|
||||
public final int prefixCompare(byte[] bs, int p) {
|
||||
int cmp;
|
||||
|
||||
cmp = NB.compareUInt64(w1, mask(1, NB.decodeInt64(bs, p)));
|
||||
|
@ -313,7 +313,7 @@ public final int prefixCompare(final byte[] bs, final int p) {
|
|||
* >0 if this abbreviation names an object that is after
|
||||
* <code>other</code>.
|
||||
*/
|
||||
public final int prefixCompare(final long[] bs, final int p) {
|
||||
public final int prefixCompare(long[] bs, int p) {
|
||||
int cmp;
|
||||
|
||||
cmp = NB.compareUInt64(w1, mask(1, bs[p]));
|
||||
|
@ -340,7 +340,7 @@ public final int getFirstByte() {
|
|||
return (int) (w1 >>> 56);
|
||||
}
|
||||
|
||||
private long mask(final long word, final long v) {
|
||||
private long mask(long word, long v) {
|
||||
return mask(nibbles, word, v);
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ public int hashCode() {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof AbbreviatedLongObjectId) {
|
||||
final AbbreviatedLongObjectId b = (AbbreviatedLongObjectId) o;
|
||||
return nibbles == b.nibbles && w1 == b.w1 && w2 == b.w2
|
||||
|
|
|
@ -170,7 +170,7 @@ public final int getByte(int index) {
|
|||
* Compare this LongObjectId to another and obtain a sort ordering.
|
||||
*/
|
||||
@Override
|
||||
public final int compareTo(final AnyLongObjectId other) {
|
||||
public final int compareTo(AnyLongObjectId other) {
|
||||
if (this == other)
|
||||
return 0;
|
||||
|
||||
|
@ -202,7 +202,7 @@ public final int compareTo(final AnyLongObjectId other) {
|
|||
* @return a negative integer, zero, or a positive integer as this object is
|
||||
* less than, equal to, or greater than the specified object.
|
||||
*/
|
||||
public final int compareTo(final byte[] bs, final int p) {
|
||||
public final int compareTo(byte[] bs, int p) {
|
||||
int cmp;
|
||||
|
||||
cmp = NB.compareUInt64(w1, NB.decodeInt64(bs, p));
|
||||
|
@ -231,7 +231,7 @@ public final int compareTo(final byte[] bs, final int p) {
|
|||
* @return a negative integer, zero, or a positive integer as this object is
|
||||
* less than, equal to, or greater than the specified object.
|
||||
*/
|
||||
public final int compareTo(final long[] bs, final int p) {
|
||||
public final int compareTo(long[] bs, int p) {
|
||||
int cmp;
|
||||
|
||||
cmp = NB.compareUInt64(w1, bs[p]);
|
||||
|
@ -257,7 +257,7 @@ public final int compareTo(final long[] bs, final int p) {
|
|||
* @return true if this LongObjectId begins with the abbreviation; else
|
||||
* false.
|
||||
*/
|
||||
public boolean startsWith(final AbbreviatedLongObjectId abbr) {
|
||||
public boolean startsWith(AbbreviatedLongObjectId abbr) {
|
||||
return abbr.prefixCompare(this) == 0;
|
||||
}
|
||||
|
||||
|
@ -274,13 +274,13 @@ public final int hashCode() {
|
|||
* the other id to compare to. May be null.
|
||||
* @return true only if both LongObjectIds have identical bits.
|
||||
*/
|
||||
public final boolean equals(final AnyLongObjectId other) {
|
||||
public final boolean equals(AnyLongObjectId other) {
|
||||
return other != null ? equals(this, other) : false;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean equals(final Object o) {
|
||||
public final boolean equals(Object o) {
|
||||
if (o instanceof AnyLongObjectId)
|
||||
return equals((AnyLongObjectId) o);
|
||||
else
|
||||
|
@ -293,7 +293,7 @@ public final boolean equals(final Object o) {
|
|||
* @param w
|
||||
* the buffer to copy to. Must be in big endian order.
|
||||
*/
|
||||
public void copyRawTo(final ByteBuffer w) {
|
||||
public void copyRawTo(ByteBuffer w) {
|
||||
w.putLong(w1);
|
||||
w.putLong(w2);
|
||||
w.putLong(w3);
|
||||
|
@ -308,7 +308,7 @@ public void copyRawTo(final ByteBuffer w) {
|
|||
* @param o
|
||||
* the offset within b to write at.
|
||||
*/
|
||||
public void copyRawTo(final byte[] b, final int o) {
|
||||
public void copyRawTo(byte[] b, int o) {
|
||||
NB.encodeInt64(b, o, w1);
|
||||
NB.encodeInt64(b, o + 8, w2);
|
||||
NB.encodeInt64(b, o + 16, w3);
|
||||
|
@ -323,7 +323,7 @@ public void copyRawTo(final byte[] b, final int o) {
|
|||
* @param o
|
||||
* the offset within b to write at.
|
||||
*/
|
||||
public void copyRawTo(final long[] b, final int o) {
|
||||
public void copyRawTo(long[] b, int o) {
|
||||
b[o] = w1;
|
||||
b[o + 1] = w2;
|
||||
b[o + 2] = w3;
|
||||
|
@ -338,14 +338,14 @@ public void copyRawTo(final long[] b, final int o) {
|
|||
* @throws java.io.IOException
|
||||
* the stream writing failed.
|
||||
*/
|
||||
public void copyRawTo(final OutputStream w) throws IOException {
|
||||
public void copyRawTo(OutputStream w) throws IOException {
|
||||
writeRawLong(w, w1);
|
||||
writeRawLong(w, w2);
|
||||
writeRawLong(w, w3);
|
||||
writeRawLong(w, w4);
|
||||
}
|
||||
|
||||
private static void writeRawLong(final OutputStream w, long v)
|
||||
private static void writeRawLong(OutputStream w, long v)
|
||||
throws IOException {
|
||||
w.write((int) (v >>> 56));
|
||||
w.write((int) (v >>> 48));
|
||||
|
@ -365,7 +365,7 @@ private static void writeRawLong(final OutputStream w, long v)
|
|||
* @throws java.io.IOException
|
||||
* the stream writing failed.
|
||||
*/
|
||||
public void copyTo(final OutputStream w) throws IOException {
|
||||
public void copyTo(OutputStream w) throws IOException {
|
||||
w.write(toHexByteArray());
|
||||
}
|
||||
|
||||
|
@ -406,7 +406,7 @@ private byte[] toHexByteArray() {
|
|||
private static final byte[] hexbyte = { '0', '1', '2', '3', '4', '5', '6',
|
||||
'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
|
||||
private static void formatHexByte(final byte[] dst, final int p, long w) {
|
||||
private static void formatHexByte(byte[] dst, int p, long w) {
|
||||
int o = p + 15;
|
||||
while (o >= p && w != 0) {
|
||||
dst[o--] = hexbyte[(int) (w & 0xf)];
|
||||
|
@ -424,7 +424,7 @@ private static void formatHexByte(final byte[] dst, final int p, long w) {
|
|||
* @throws java.io.IOException
|
||||
* the stream writing failed.
|
||||
*/
|
||||
public void copyTo(final Writer w) throws IOException {
|
||||
public void copyTo(Writer w) throws IOException {
|
||||
w.write(toHexCharArray());
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ public void copyTo(final Writer w) throws IOException {
|
|||
* @throws java.io.IOException
|
||||
* the stream writing failed.
|
||||
*/
|
||||
public void copyTo(final char[] tmp, final Writer w) throws IOException {
|
||||
public void copyTo(char[] tmp, Writer w) throws IOException {
|
||||
toHexCharArray(tmp);
|
||||
w.write(tmp, 0, Constants.LONG_OBJECT_ID_STRING_LENGTH);
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ public void copyTo(final char[] tmp, final Writer w) throws IOException {
|
|||
* @param w
|
||||
* the string to append onto.
|
||||
*/
|
||||
public void copyTo(final char[] tmp, final StringBuilder w) {
|
||||
public void copyTo(char[] tmp, StringBuilder w) {
|
||||
toHexCharArray(tmp);
|
||||
w.append(tmp, 0, Constants.LONG_OBJECT_ID_STRING_LENGTH);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ char[] toHexCharArray() {
|
|||
return dst;
|
||||
}
|
||||
|
||||
private void toHexCharArray(final char[] dst) {
|
||||
private void toHexCharArray(char[] dst) {
|
||||
formatHexChar(dst, 0, w1);
|
||||
formatHexChar(dst, 16, w2);
|
||||
formatHexChar(dst, 32, w3);
|
||||
|
@ -524,7 +524,7 @@ public final String getName() {
|
|||
* length of the abbreviated string.
|
||||
* @return SHA-256 abbreviation.
|
||||
*/
|
||||
public AbbreviatedLongObjectId abbreviate(final int len) {
|
||||
public AbbreviatedLongObjectId abbreviate(int len) {
|
||||
final long a = AbbreviatedLongObjectId.mask(len, 1, w1);
|
||||
final long b = AbbreviatedLongObjectId.mask(len, 2, w2);
|
||||
final long c = AbbreviatedLongObjectId.mask(len, 3, w3);
|
||||
|
|
|
@ -90,7 +90,7 @@ public static final LongObjectId zeroId() {
|
|||
* the string to test.
|
||||
* @return true if the string can converted into an LongObjectId.
|
||||
*/
|
||||
public static final boolean isId(final String id) {
|
||||
public static final boolean isId(String id) {
|
||||
if (id.length() != Constants.LONG_OBJECT_ID_STRING_LENGTH)
|
||||
return false;
|
||||
try {
|
||||
|
@ -110,7 +110,7 @@ public static final boolean isId(final String id) {
|
|||
* the id to convert. May be null.
|
||||
* @return the hex string conversion of this id's content.
|
||||
*/
|
||||
public static final String toString(final LongObjectId i) {
|
||||
public static final String toString(LongObjectId i) {
|
||||
return i != null ? i.name() : ZEROID_STR;
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public static boolean equals(final byte[] firstBuffer, final int fi,
|
|||
* available within this byte array.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final LongObjectId fromRaw(final byte[] bs) {
|
||||
public static final LongObjectId fromRaw(byte[] bs) {
|
||||
return fromRaw(bs, 0);
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public static final LongObjectId fromRaw(final byte[] bs) {
|
|||
* position to read the first byte of data from.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final LongObjectId fromRaw(final byte[] bs, final int p) {
|
||||
public static final LongObjectId fromRaw(byte[] bs, int p) {
|
||||
final long a = NB.decodeInt64(bs, p);
|
||||
final long b = NB.decodeInt64(bs, p + 8);
|
||||
final long c = NB.decodeInt64(bs, p + 16);
|
||||
|
@ -203,7 +203,7 @@ public static final LongObjectId fromRaw(final byte[] bs, final int p) {
|
|||
* available within this long array.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final LongObjectId fromRaw(final long[] is) {
|
||||
public static final LongObjectId fromRaw(long[] is) {
|
||||
return fromRaw(is, 0);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ public static final LongObjectId fromRaw(final long[] is) {
|
|||
* position to read the first long of data from.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final LongObjectId fromRaw(final long[] is, final int p) {
|
||||
public static final LongObjectId fromRaw(long[] is, int p) {
|
||||
return new LongObjectId(is[p], is[p + 1], is[p + 2], is[p + 3]);
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ public static final LongObjectId fromRaw(final long[] is, final int p) {
|
|||
* position to read the first character from.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static final LongObjectId fromString(final byte[] buf, final int offset) {
|
||||
public static final LongObjectId fromString(byte[] buf, int offset) {
|
||||
return fromHexString(buf, offset);
|
||||
}
|
||||
|
||||
|
@ -242,14 +242,14 @@ public static final LongObjectId fromString(final byte[] buf, final int offset)
|
|||
* the string to read from. Must be 64 characters long.
|
||||
* @return the converted object id.
|
||||
*/
|
||||
public static LongObjectId fromString(final String str) {
|
||||
public static LongObjectId fromString(String str) {
|
||||
if (str.length() != Constants.LONG_OBJECT_ID_STRING_LENGTH)
|
||||
throw new InvalidLongObjectIdException(str);
|
||||
return fromHexString(org.eclipse.jgit.lib.Constants.encodeASCII(str),
|
||||
0);
|
||||
}
|
||||
|
||||
private static final LongObjectId fromHexString(final byte[] bs, int p) {
|
||||
private static final LongObjectId fromHexString(byte[] bs, int p) {
|
||||
try {
|
||||
final long a = RawParseUtils.parseHexInt64(bs, p);
|
||||
final long b = RawParseUtils.parseHexInt64(bs, p + 16);
|
||||
|
@ -280,7 +280,7 @@ private static final LongObjectId fromHexString(final byte[] bs, int p) {
|
|||
* @param src
|
||||
* another already parsed LongObjectId to copy the value out of.
|
||||
*/
|
||||
protected LongObjectId(final AnyLongObjectId src) {
|
||||
protected LongObjectId(AnyLongObjectId src) {
|
||||
w1 = src.w1;
|
||||
w2 = src.w2;
|
||||
w3 = src.w3;
|
||||
|
|
|
@ -167,7 +167,7 @@ public void fromObjectId(AnyLongObjectId src) {
|
|||
* the raw byte buffer to read from. At least 32 bytes must be
|
||||
* available within this byte array.
|
||||
*/
|
||||
public void fromRaw(final byte[] bs) {
|
||||
public void fromRaw(byte[] bs) {
|
||||
fromRaw(bs, 0);
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ public void fromRaw(final byte[] bs) {
|
|||
* @param p
|
||||
* position to read the first byte of data from.
|
||||
*/
|
||||
public void fromRaw(final byte[] bs, final int p) {
|
||||
public void fromRaw(byte[] bs, int p) {
|
||||
w1 = NB.decodeInt64(bs, p);
|
||||
w2 = NB.decodeInt64(bs, p + 8);
|
||||
w3 = NB.decodeInt64(bs, p + 16);
|
||||
|
@ -194,7 +194,7 @@ public void fromRaw(final byte[] bs, final int p) {
|
|||
* the raw long buffer to read from. At least 4 longs must be
|
||||
* available within this longs array.
|
||||
*/
|
||||
public void fromRaw(final long[] longs) {
|
||||
public void fromRaw(long[] longs) {
|
||||
fromRaw(longs, 0);
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ public void fromRaw(final long[] longs) {
|
|||
* @param p
|
||||
* position to read the first integer of data from.
|
||||
*/
|
||||
public void fromRaw(final long[] longs, final int p) {
|
||||
public void fromRaw(long[] longs, int p) {
|
||||
w1 = longs[p];
|
||||
w2 = longs[p + 1];
|
||||
w3 = longs[p + 2];
|
||||
|
@ -223,7 +223,7 @@ public void fromRaw(final long[] longs, final int p) {
|
|||
* @param offset
|
||||
* position to read the first character from.
|
||||
*/
|
||||
public void fromString(final byte[] buf, final int offset) {
|
||||
public void fromString(byte[] buf, int offset) {
|
||||
fromHexString(buf, offset);
|
||||
}
|
||||
|
||||
|
@ -233,14 +233,14 @@ public void fromString(final byte[] buf, final int offset) {
|
|||
* @param str
|
||||
* the string to read from. Must be 64 characters long.
|
||||
*/
|
||||
public void fromString(final String str) {
|
||||
public void fromString(String str) {
|
||||
if (str.length() != Constants.LONG_OBJECT_ID_STRING_LENGTH)
|
||||
throw new IllegalArgumentException(
|
||||
MessageFormat.format(LfsText.get().invalidLongId, str));
|
||||
fromHexString(org.eclipse.jgit.lib.Constants.encodeASCII(str), 0);
|
||||
}
|
||||
|
||||
private void fromHexString(final byte[] bs, int p) {
|
||||
private void fromHexString(byte[] bs, int p) {
|
||||
try {
|
||||
w1 = RawParseUtils.parseHexInt64(bs, p);
|
||||
w2 = RawParseUtils.parseHexInt64(bs, p + 16);
|
||||
|
|
|
@ -122,17 +122,17 @@ protected Path writeLink(String link, String target) throws Exception {
|
|||
return JGitTestUtil.writeLink(db, link, target);
|
||||
}
|
||||
|
||||
protected File writeTrashFile(final String name, final String data)
|
||||
protected File writeTrashFile(String name, String data)
|
||||
throws IOException {
|
||||
return JGitTestUtil.writeTrashFile(db, name, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String read(final File file) throws IOException {
|
||||
protected String read(File file) throws IOException {
|
||||
return JGitTestUtil.read(file);
|
||||
}
|
||||
|
||||
protected void deleteTrashFile(final String name) throws IOException {
|
||||
protected void deleteTrashFile(String name) throws IOException {
|
||||
JGitTestUtil.deleteTrashFile(db, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -700,7 +700,7 @@ private static String[] listZipEntries(byte[] zipData) throws IOException {
|
|||
return l.toArray(new String[l.size()]);
|
||||
}
|
||||
|
||||
private static Future<Object> writeAsync(final OutputStream stream, final byte[] data) {
|
||||
private static Future<Object> writeAsync(OutputStream stream, byte[] data) {
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
return executor.submit(new Callable<Object>() {
|
||||
|
|
|
@ -74,7 +74,7 @@ abstract class AbstractFetchCommand extends TextBuiltin {
|
|||
* @throws java.io.IOException
|
||||
* if any.
|
||||
*/
|
||||
protected void showFetchResult(final FetchResult r) throws IOException {
|
||||
protected void showFetchResult(FetchResult r) throws IOException {
|
||||
try (ObjectReader reader = db.newObjectReader()) {
|
||||
boolean shownURI = false;
|
||||
for (final TrackingRefUpdate u : r.getTrackingRefUpdates()) {
|
||||
|
@ -181,7 +181,7 @@ private static String safeAbbreviate(ObjectReader reader, ObjectId id) {
|
|||
}
|
||||
}
|
||||
|
||||
private static char shortTypeOf(final RefUpdate.Result r) {
|
||||
private static char shortTypeOf(RefUpdate.Result r) {
|
||||
if (r == RefUpdate.Result.LOCK_FAILURE)
|
||||
return '!';
|
||||
if (r == RefUpdate.Result.IO_FAILURE)
|
||||
|
|
|
@ -302,7 +302,7 @@ else if (remote)
|
|||
}
|
||||
}
|
||||
|
||||
private void addRefs(final Collection<Ref> refs, final String prefix) {
|
||||
private void addRefs(Collection<Ref> refs, String prefix) {
|
||||
for (final Ref ref : RefComparator.sort(refs)) {
|
||||
final String name = ref.getName();
|
||||
if (name.startsWith(prefix))
|
||||
|
@ -310,7 +310,7 @@ private void addRefs(final Collection<Ref> refs, final String prefix) {
|
|||
}
|
||||
}
|
||||
|
||||
private void addRef(final String name, final Ref ref) {
|
||||
private void addRef(String name, Ref ref) {
|
||||
printRefs.put(name, ref);
|
||||
maxNameLength = Math.max(maxNameLength, name.length());
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class CommandCatalog {
|
|||
* was derived from the DashLowerCaseForm class name.
|
||||
* @return the command instance; null if no command exists by that name.
|
||||
*/
|
||||
public static CommandRef get(final String name) {
|
||||
public static CommandRef get(String name) {
|
||||
return INSTANCE.commands.get(name);
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,11 @@ public static CommandRef[] common() {
|
|||
return toSortedArray(common);
|
||||
}
|
||||
|
||||
private static CommandRef[] toSortedArray(final Collection<CommandRef> c) {
|
||||
private static CommandRef[] toSortedArray(Collection<CommandRef> c) {
|
||||
final CommandRef[] r = c.toArray(new CommandRef[c.size()]);
|
||||
Arrays.sort(r, new Comparator<CommandRef>() {
|
||||
@Override
|
||||
public int compare(final CommandRef o1, final CommandRef o2) {
|
||||
public int compare(CommandRef o1, CommandRef o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
|
@ -146,7 +146,7 @@ private Enumeration<URL> catalogs() {
|
|||
}
|
||||
}
|
||||
|
||||
private void scan(final URL cUrl) {
|
||||
private void scan(URL cUrl) {
|
||||
try (BufferedReader cIn = new BufferedReader(
|
||||
new InputStreamReader(cUrl.openStream(), CHARSET))) {
|
||||
String line;
|
||||
|
@ -159,7 +159,7 @@ private void scan(final URL cUrl) {
|
|||
}
|
||||
}
|
||||
|
||||
private void load(final String cn) {
|
||||
private void load(String cn) {
|
||||
final Class<? extends TextBuiltin> clazz;
|
||||
try {
|
||||
clazz = Class.forName(cn, false, ldr).asSubclass(TextBuiltin.class);
|
||||
|
|
|
@ -76,13 +76,13 @@ public class CommandRef {
|
|||
common = cmd.common();
|
||||
}
|
||||
|
||||
private CommandRef(final Class<? extends TextBuiltin> clazz, final String cn) {
|
||||
private CommandRef(Class<? extends TextBuiltin> clazz, String cn) {
|
||||
impl = clazz;
|
||||
name = cn;
|
||||
usage = ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static String guessName(final Class<? extends TextBuiltin> clazz) {
|
||||
private static String guessName(Class<? extends TextBuiltin> clazz) {
|
||||
final StringBuilder s = new StringBuilder();
|
||||
if (clazz.getName().startsWith("org.eclipse.jgit.pgm.debug.")) //$NON-NLS-1$
|
||||
s.append("debug-"); //$NON-NLS-1$
|
||||
|
|
|
@ -63,7 +63,7 @@ public class Die extends RuntimeException {
|
|||
* @param why
|
||||
* the message to show to the end-user.
|
||||
*/
|
||||
public Die(final String why) {
|
||||
public Die(String why) {
|
||||
super(why);
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ public Die(final String why) {
|
|||
* @param cause
|
||||
* why the command has failed.
|
||||
*/
|
||||
public Die(final String why, final Throwable cause) {
|
||||
public Die(String why, Throwable cause) {
|
||||
super(why, cause);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public Die(boolean aborted) {
|
|||
* can be null
|
||||
* @since 4.2
|
||||
*/
|
||||
public Die(boolean aborted, final Throwable cause) {
|
||||
public Die(boolean aborted, Throwable cause) {
|
||||
super(cause != null ? cause.getMessage() : null, cause);
|
||||
this.aborted = aborted;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ void noPrefix(@SuppressWarnings("unused") boolean on) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void init(final Repository repository, final String gitDir) {
|
||||
protected void init(Repository repository, String gitDir) {
|
||||
super.init(repository, gitDir);
|
||||
diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class Glog extends RevWalkTextBuiltin {
|
|||
frame = new JFrame();
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent e) {
|
||||
public void windowClosing(WindowEvent e) {
|
||||
frame.dispose();
|
||||
}
|
||||
});
|
||||
|
@ -116,7 +116,7 @@ protected int walkLoop() throws Exception {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void show(final RevCommit c) throws Exception {
|
||||
protected void show(RevCommit c) throws Exception {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ void noPrefix(@SuppressWarnings("unused") boolean on) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void init(final Repository repository, final String gitDir) {
|
||||
protected void init(Repository repository, String gitDir) {
|
||||
super.init(repository, gitDir);
|
||||
diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ private void addNoteMap(String notesRef) throws IOException {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void show(final RevCommit c) throws Exception {
|
||||
protected void show(RevCommit c) throws Exception {
|
||||
outw.print(CLIText.get().commitLabel);
|
||||
outw.print(" "); //$NON-NLS-1$
|
||||
c.getId().copyTo(outbuffer, outw);
|
||||
|
|
|
@ -96,7 +96,7 @@ protected boolean requiresRepository() {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void show(final AnyObjectId id, final String name)
|
||||
private void show(AnyObjectId id, String name)
|
||||
throws IOException {
|
||||
outw.print(id.name());
|
||||
outw.print('\t');
|
||||
|
|
|
@ -141,7 +141,7 @@ public Thread newThread(Runnable taskBody) {
|
|||
* arguments.
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
public static void main(final String[] argv) throws Exception {
|
||||
public static void main(String[] argv) throws Exception {
|
||||
// make sure built-in filters are registered
|
||||
BuiltinLFS.register();
|
||||
|
||||
|
@ -165,7 +165,7 @@ public static void main(final String[] argv) throws Exception {
|
|||
* arguments.
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected void run(final String[] argv) throws Exception {
|
||||
protected void run(String[] argv) throws Exception {
|
||||
writer = createErrorWriter();
|
||||
try {
|
||||
if (!installConsole()) {
|
||||
|
@ -230,7 +230,7 @@ PrintWriter createErrorWriter() {
|
|||
return new PrintWriter(new OutputStreamWriter(System.err, CHARSET));
|
||||
}
|
||||
|
||||
private void execute(final String[] argv) throws Exception {
|
||||
private void execute(String[] argv) throws Exception {
|
||||
final CmdLineParser clp = new SubcommandLineParser(this);
|
||||
|
||||
try {
|
||||
|
@ -360,7 +360,7 @@ private static boolean installConsole() {
|
|||
}
|
||||
}
|
||||
|
||||
private static void install(final String name)
|
||||
private static void install(String name)
|
||||
throws IllegalAccessException, InvocationTargetException,
|
||||
NoSuchMethodException, ClassNotFoundException {
|
||||
try {
|
||||
|
|
|
@ -146,7 +146,7 @@ protected void run() throws Exception {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void printUsage(final String message, final CmdLineParser clp)
|
||||
public void printUsage(String message, CmdLineParser clp)
|
||||
throws IOException {
|
||||
errw.println(message);
|
||||
errw.println("jgit remote [--verbose (-v)] [--help (-h)]"); //$NON-NLS-1$
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
class RevList extends RevWalkTextBuiltin {
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void show(final RevCommit c) throws Exception {
|
||||
protected void show(RevCommit c) throws Exception {
|
||||
if (c.has(RevFlag.UNINTERESTING))
|
||||
outw.print('-');
|
||||
c.getId().copyTo(outbuffer, outw);
|
||||
|
@ -67,7 +67,7 @@ protected void show(final RevCommit c) throws Exception {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void show(final ObjectWalk ow, final RevObject obj)
|
||||
protected void show(ObjectWalk ow, RevObject obj)
|
||||
throws Exception {
|
||||
if (obj.has(RevFlag.UNINTERESTING))
|
||||
outw.print('-');
|
||||
|
|
|
@ -91,7 +91,7 @@ abstract class RevWalkTextBuiltin extends TextBuiltin {
|
|||
|
||||
private final EnumSet<RevSort> sorting = EnumSet.noneOf(RevSort.class);
|
||||
|
||||
private void enableRevSort(final RevSort type, final boolean on) {
|
||||
private void enableRevSort(RevSort type, boolean on) {
|
||||
if (on)
|
||||
sorting.add(type);
|
||||
else
|
||||
|
@ -260,7 +260,7 @@ protected int walkLoop() throws Exception {
|
|||
* The current {@link org.eclipse.jgit.revwalk.RevCommit}
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
protected abstract void show(final RevCommit c) throws Exception;
|
||||
protected abstract void show(RevCommit c) throws Exception;
|
||||
|
||||
/**
|
||||
* "Show" the current RevCommit when called from the main processing loop.
|
||||
|
|
|
@ -167,7 +167,7 @@ void noPrefix(@SuppressWarnings("unused") boolean on) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
protected void init(final Repository repository, final String gitDir) {
|
||||
protected void init(Repository repository, String gitDir) {
|
||||
super.init(repository, gitDir);
|
||||
diffFmt = new DiffFormatter(new BufferedOutputStream(outs));
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ private void show(RevTree obj) throws MissingObjectException,
|
|||
}
|
||||
}
|
||||
|
||||
private void show(RevWalk rw, final RevCommit c) throws Exception {
|
||||
private void show(RevWalk rw, RevCommit c) throws Exception {
|
||||
char[] outbuffer = new char[Constants.OBJECT_ID_LENGTH * 2];
|
||||
|
||||
outw.print(CLIText.get().commitLabel);
|
||||
|
|
|
@ -71,7 +71,7 @@ private Iterable<Ref> getSortedRefs() throws Exception {
|
|||
return RefComparator.sort(all);
|
||||
}
|
||||
|
||||
private void show(final AnyObjectId id, final String name)
|
||||
private void show(AnyObjectId id, String name)
|
||||
throws IOException {
|
||||
outw.print(id.name());
|
||||
outw.print('\t');
|
||||
|
|
|
@ -176,7 +176,7 @@ public void initRaw(final Repository repository, final String gitDir,
|
|||
* value of the {@code --git-dir} command line option, if
|
||||
* {@code repository} is null.
|
||||
*/
|
||||
protected void init(final Repository repository, final String gitDir) {
|
||||
protected void init(Repository repository, String gitDir) {
|
||||
try {
|
||||
final String outputEncoding = repository != null ? repository
|
||||
.getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
@ -239,7 +239,7 @@ public final void execute(String[] args) throws Exception {
|
|||
* the arguments supplied on the command line, if any.
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
protected void parseArguments(final String[] args) throws IOException {
|
||||
protected void parseArguments(String[] args) throws IOException {
|
||||
final CmdLineParser clp = new CmdLineParser(this);
|
||||
help = containsHelp(args);
|
||||
try {
|
||||
|
@ -267,7 +267,7 @@ protected void parseArguments(final String[] args) throws IOException {
|
|||
* a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object.
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void printUsageAndExit(final CmdLineParser clp) throws IOException {
|
||||
public void printUsageAndExit(CmdLineParser clp) throws IOException {
|
||||
printUsageAndExit("", clp); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ public void printUsageAndExit(final CmdLineParser clp) throws IOException {
|
|||
* a {@link org.eclipse.jgit.pgm.opt.CmdLineParser} object.
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void printUsageAndExit(final String message, final CmdLineParser clp) throws IOException {
|
||||
public void printUsageAndExit(String message, CmdLineParser clp) throws IOException {
|
||||
printUsage(message, clp);
|
||||
throw die(true);
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public void printUsageAndExit(final String message, final CmdLineParser clp) thr
|
|||
* @throws java.io.IOException
|
||||
* @since 4.2
|
||||
*/
|
||||
protected void printUsage(final String message, final CmdLineParser clp)
|
||||
protected void printUsage(String message, CmdLineParser clp)
|
||||
throws IOException {
|
||||
errw.println(message);
|
||||
errw.print("jgit "); //$NON-NLS-1$
|
||||
|
@ -375,7 +375,7 @@ ObjectId resolve(final String s) throws IOException {
|
|||
* textual explanation
|
||||
* @return a runtime exception the caller is expected to throw
|
||||
*/
|
||||
protected static Die die(final String why) {
|
||||
protected static Die die(String why) {
|
||||
return new Die(why);
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ protected static Die die(final String why) {
|
|||
* why the command has failed.
|
||||
* @return a runtime exception the caller is expected to throw
|
||||
*/
|
||||
protected static Die die(final String why, final Throwable cause) {
|
||||
protected static Die die(String why, Throwable cause) {
|
||||
return new Die(why, cause);
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ protected static Die die(boolean aborted) {
|
|||
* @return a runtime exception the caller is expected to throw
|
||||
* @since 4.2
|
||||
*/
|
||||
protected static Die die(boolean aborted, final Throwable cause) {
|
||||
protected static Die die(boolean aborted, Throwable cause) {
|
||||
return new Die(aborted, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ protected void run() throws Exception {
|
|||
show(tree);
|
||||
}
|
||||
|
||||
private void show(final DirCacheTree tree) throws IOException {
|
||||
private void show(DirCacheTree tree) throws IOException {
|
||||
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
|
||||
tree.getPathString(), valueOf(tree.getEntrySpan()),
|
||||
valueOf(tree.getChildCount())));
|
||||
|
|
|
@ -258,7 +258,7 @@ private void recreateRefs() throws Exception {
|
|||
final Map<String, Ref> refs = computeNewRefs();
|
||||
new RefWriter(refs.values()) {
|
||||
@Override
|
||||
protected void writeFile(final String name, final byte[] content)
|
||||
protected void writeFile(String name, byte[] content)
|
||||
throws IOException {
|
||||
final File file = new File(db.getDirectory(), name);
|
||||
final LockFile lck = new LockFile(file);
|
||||
|
|
|
@ -67,7 +67,7 @@ protected void run() throws Exception {
|
|||
show(tree);
|
||||
}
|
||||
|
||||
private void show(final DirCacheTree tree) throws IOException {
|
||||
private void show(DirCacheTree tree) throws IOException {
|
||||
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
|
||||
tree.getPathString(), valueOf(tree.getEntrySpan()),
|
||||
valueOf(tree.getChildCount())));
|
||||
|
|
|
@ -499,7 +499,7 @@ public boolean equals(Object obj) {
|
|||
}
|
||||
}
|
||||
|
||||
private static int tableBits(final int sz) {
|
||||
private static int tableBits(int sz) {
|
||||
int bits = 31 - Integer.numberOfLeadingZeros(sz);
|
||||
if (bits == 0)
|
||||
bits = 1;
|
||||
|
|
|
@ -98,7 +98,7 @@ public AbstractTreeIteratorHandler(final CmdLineParser parser,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
final String name = params.getParameter(0);
|
||||
|
||||
if (new File(name).isDirectory()) {
|
||||
|
|
|
@ -111,7 +111,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser {
|
|||
* if the option bean class is using args4j annotations
|
||||
* incorrectly.
|
||||
*/
|
||||
public CmdLineParser(final Object bean) {
|
||||
public CmdLineParser(Object bean) {
|
||||
this(bean, null);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ public CmdLineParser(final Object bean) {
|
|||
* if the option bean class is using args4j annotations
|
||||
* incorrectly.
|
||||
*/
|
||||
public CmdLineParser(final Object bean, Repository repo) {
|
||||
public CmdLineParser(Object bean, Repository repo) {
|
||||
super(bean);
|
||||
if (bean instanceof TextBuiltin) {
|
||||
cmd = (TextBuiltin) bean;
|
||||
|
@ -143,7 +143,7 @@ public CmdLineParser(final Object bean, Repository repo) {
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void parseArgument(final String... args) throws CmdLineException {
|
||||
public void parseArgument(String... args) throws CmdLineException {
|
||||
final ArrayList<String> tmp = new ArrayList<>(args.length);
|
||||
for (int argi = 0; argi < args.length; argi++) {
|
||||
final String str = args[argi];
|
||||
|
@ -232,7 +232,7 @@ private void restoreRequiredOptions(List<OptionHandler> backup) {
|
|||
* @return true if the given array contains help option
|
||||
* @since 4.2
|
||||
*/
|
||||
protected boolean containsHelp(final String... args) {
|
||||
protected boolean containsHelp(String... args) {
|
||||
return TextBuiltin.containsHelp(args);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ public ObjectIdHandler(final CmdLineParser parser, final OptionDef option,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
final String name = params.getParameter(0);
|
||||
final ObjectId id;
|
||||
try {
|
||||
|
|
|
@ -84,7 +84,7 @@ public PathTreeFilterHandler(final CmdLineParser parser,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
final List<PathFilter> filters = new ArrayList<>();
|
||||
for (int idx = 0;; idx++) {
|
||||
final String path;
|
||||
|
|
|
@ -78,7 +78,7 @@ public RefSpecHandler(final CmdLineParser parser, final OptionDef option,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
setter.addValue(new RefSpec(params.getParameter(0)));
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public RevCommitHandler(final CmdLineParser parser, final OptionDef option,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
String name = params.getParameter(0);
|
||||
|
||||
boolean interesting = true;
|
||||
|
@ -115,7 +115,7 @@ public int parseArguments(final Parameters params) throws CmdLineException {
|
|||
return 1;
|
||||
}
|
||||
|
||||
private void addOne(final String name, final boolean interesting)
|
||||
private void addOne(String name, boolean interesting)
|
||||
throws CmdLineException {
|
||||
final ObjectId id;
|
||||
try {
|
||||
|
|
|
@ -87,7 +87,7 @@ public RevTreeHandler(final CmdLineParser parser, final OptionDef option,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
final String name = params.getParameter(0);
|
||||
final ObjectId id;
|
||||
try {
|
||||
|
|
|
@ -84,7 +84,7 @@ public SubcommandHandler(final CmdLineParser parser,
|
|||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public int parseArguments(final Parameters params) throws CmdLineException {
|
||||
public int parseArguments(Parameters params) throws CmdLineException {
|
||||
final String name = params.getParameter(0);
|
||||
final CommandRef cr = CommandCatalog.get(name);
|
||||
if (cr == null)
|
||||
|
|
|
@ -147,7 +147,7 @@ void onCommit(String cid, byte[] buf) {
|
|||
assertTrue("Missed files in " + cid, files.isEmpty());
|
||||
}
|
||||
|
||||
private static void dump(final byte[] buf) {
|
||||
private static void dump(byte[] buf) {
|
||||
String str;
|
||||
try {
|
||||
str = new String(buf, 0, buf.length - 1, "ISO-8859-1");
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ApplyCommandTest extends RepositoryTestCase {
|
|||
|
||||
private RawText b;
|
||||
|
||||
private ApplyResult init(final String name) throws Exception {
|
||||
private ApplyResult init(String name) throws Exception {
|
||||
return init(name, true, true);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ public void testNonASCIIDel() throws Exception {
|
|||
assertFalse(new File(db.getWorkTree(), "NonASCIIDel").exists());
|
||||
}
|
||||
|
||||
private static byte[] readFile(final String patchFile) throws IOException {
|
||||
private static byte[] readFile(String patchFile) throws IOException {
|
||||
final InputStream in = getTestResource(patchFile);
|
||||
if (in == null) {
|
||||
fail("No " + patchFile + " test vector");
|
||||
|
@ -291,7 +291,7 @@ private static byte[] readFile(final String patchFile) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private static InputStream getTestResource(final String patchFile) {
|
||||
private static InputStream getTestResource(String patchFile) {
|
||||
return ApplyCommandTest.class.getClassLoader()
|
||||
.getResourceAsStream("org/eclipse/jgit/diff/" + patchFile);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ public void testMoveToOtherDir() throws Exception {
|
|||
testRename("subdir/file1.txt", "otherdir/file1.txt");
|
||||
}
|
||||
|
||||
private void testRename(final String sourcePath, final String destPath)
|
||||
private void testRename(String sourcePath, String destPath)
|
||||
throws Exception {
|
||||
try (Git git = new Git(db)) {
|
||||
String[] content1 = new String[] { "a", "b", "c" };
|
||||
|
|
|
@ -338,7 +338,7 @@ public void testCherryPickOurCommitName() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
private RevCommit prepareCherryPick(final Git git) throws Exception {
|
||||
private RevCommit prepareCherryPick(Git git) throws Exception {
|
||||
// create, add and commit file a
|
||||
writeTrashFile("a", "a");
|
||||
git.add().addFilepattern("a").call();
|
||||
|
|
|
@ -1699,7 +1699,7 @@ private static boolean canExecute(Git git, String path) {
|
|||
.getWorkTree(), path));
|
||||
}
|
||||
|
||||
private static RevCommit addAllAndCommit(final Git git) throws Exception {
|
||||
private static RevCommit addAllAndCommit(Git git) throws Exception {
|
||||
git.add().addFilepattern(".").call();
|
||||
return git.commit().setMessage("message").call();
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ public void testPrePushHook() throws JGitInternalException, IOException,
|
|||
}
|
||||
}
|
||||
|
||||
private File writeHookFile(final String name, final String data)
|
||||
private File writeHookFile(String name, String data)
|
||||
throws IOException {
|
||||
File path = new File(db.getWorkTree() + "/.git/hooks/", name);
|
||||
JGitTestUtil.write(path, data);
|
||||
|
|
|
@ -379,7 +379,7 @@ public void testRevertOurCommitName() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
private RevCommit prepareRevert(final Git git) throws Exception {
|
||||
private RevCommit prepareRevert(Git git) throws Exception {
|
||||
// create, add and commit file a
|
||||
writeTrashFile("a", "a");
|
||||
git.add().addFilepattern("a").call();
|
||||
|
|
|
@ -94,7 +94,7 @@ public void setUp() throws Exception {
|
|||
untrackedFile = writeTrashFile("untracked.txt", "content");
|
||||
}
|
||||
|
||||
private void validateStashedCommit(final RevCommit commit)
|
||||
private void validateStashedCommit(RevCommit commit)
|
||||
throws IOException {
|
||||
validateStashedCommit(commit, 2);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ private TreeWalk createTreeWalk() {
|
|||
return walk;
|
||||
}
|
||||
|
||||
private List<DiffEntry> diffWorkingAgainstHead(final RevCommit commit)
|
||||
private List<DiffEntry> diffWorkingAgainstHead(RevCommit commit)
|
||||
throws IOException {
|
||||
try (TreeWalk walk = createTreeWalk()) {
|
||||
walk.addTree(commit.getParent(0).getTree());
|
||||
|
@ -149,7 +149,7 @@ private List<DiffEntry> diffWorkingAgainstHead(final RevCommit commit)
|
|||
}
|
||||
}
|
||||
|
||||
private List<DiffEntry> diffIndexAgainstHead(final RevCommit commit)
|
||||
private List<DiffEntry> diffIndexAgainstHead(RevCommit commit)
|
||||
throws IOException {
|
||||
try (TreeWalk walk = createTreeWalk()) {
|
||||
walk.addTree(commit.getParent(0).getTree());
|
||||
|
@ -158,7 +158,7 @@ private List<DiffEntry> diffIndexAgainstHead(final RevCommit commit)
|
|||
}
|
||||
}
|
||||
|
||||
private List<DiffEntry> diffIndexAgainstWorking(final RevCommit commit)
|
||||
private List<DiffEntry> diffIndexAgainstWorking(RevCommit commit)
|
||||
throws IOException {
|
||||
try (TreeWalk walk = createTreeWalk()) {
|
||||
walk.addTree(commit.getParent(1).getTree());
|
||||
|
|
|
@ -146,7 +146,7 @@ public void testNoNewLine2() throws IOException {
|
|||
assertFormatted("Z.patch");
|
||||
}
|
||||
|
||||
private void init(final String name) throws IOException {
|
||||
private void init(String name) throws IOException {
|
||||
a = new RawText(readFile(name + "_PreImage"));
|
||||
b = new RawText(readFile(name + "_PostImage"));
|
||||
file = parseTestPatchFile(name + ".patch").getFiles().get(0);
|
||||
|
@ -156,13 +156,13 @@ private void assertFormatted() throws IOException {
|
|||
assertFormatted(JGitTestUtil.getName() + ".out");
|
||||
}
|
||||
|
||||
private void assertFormatted(final String name) throws IOException {
|
||||
private void assertFormatted(String name) throws IOException {
|
||||
fmt.format(file, a, b);
|
||||
final String exp = RawParseUtils.decode(readFile(name));
|
||||
assertEquals(exp, RawParseUtils.decode(out.toByteArray()));
|
||||
}
|
||||
|
||||
private byte[] readFile(final String patchFile) throws IOException {
|
||||
private byte[] readFile(String patchFile) throws IOException {
|
||||
final InputStream in = getClass().getResourceAsStream(patchFile);
|
||||
if (in == null) {
|
||||
fail("No " + patchFile + " test vector");
|
||||
|
@ -180,7 +180,7 @@ private byte[] readFile(final String patchFile) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private Patch parseTestPatchFile(final String patchFile) throws IOException {
|
||||
private Patch parseTestPatchFile(String patchFile) throws IOException {
|
||||
try (InputStream in = getClass().getResourceAsStream(patchFile)) {
|
||||
if (in == null) {
|
||||
fail("No " + patchFile + " test vector");
|
||||
|
|
|
@ -229,7 +229,7 @@ private static void assertV3TreeEntry(int indexPosition, String path,
|
|||
assertEquals(intentToAdd, entry.isIntentToAdd());
|
||||
}
|
||||
|
||||
private static File pathOf(final String name) {
|
||||
private static File pathOf(String name) {
|
||||
return JGitTestUtil.getTestResourceFile(name);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ public void testCopyMetaDataWithoutStage() {
|
|||
copyMetaDataHelper(true);
|
||||
}
|
||||
|
||||
private static void copyMetaDataHelper(final boolean keepStage) {
|
||||
private static void copyMetaDataHelper(boolean keepStage) {
|
||||
DirCacheEntry e = new DirCacheEntry("some/path", DirCacheEntry.STAGE_2);
|
||||
e.setAssumeValid(false);
|
||||
e.setCreationTime(2L);
|
||||
|
|
|
@ -81,7 +81,7 @@ public void testPath_16384() throws Exception {
|
|||
testLongPath(16384);
|
||||
}
|
||||
|
||||
private void testLongPath(final int len) throws CorruptObjectException,
|
||||
private void testLongPath(int len) throws CorruptObjectException,
|
||||
IOException {
|
||||
final String longPath = makeLongPath(len);
|
||||
final String shortPath = "~~~ shorter-path";
|
||||
|
@ -119,7 +119,7 @@ private void testLongPath(final int len) throws CorruptObjectException,
|
|||
}
|
||||
}
|
||||
|
||||
private static String makeLongPath(final int len) {
|
||||
private static String makeLongPath(int len) {
|
||||
final StringBuilder r = new StringBuilder(len);
|
||||
for (int i = 0; i < len; i++)
|
||||
r.append('a' + (i % 26));
|
||||
|
|
|
@ -210,14 +210,14 @@ private static void whackCache() {
|
|||
config.install();
|
||||
}
|
||||
|
||||
private RevObject parse(final AnyObjectId id)
|
||||
private RevObject parse(AnyObjectId id)
|
||||
throws MissingObjectException, IOException {
|
||||
try (RevWalk rw = new RevWalk(db)) {
|
||||
return rw.parseAny(id);
|
||||
}
|
||||
}
|
||||
|
||||
private File[] pack(final Repository src, final RevObject... list)
|
||||
private File[] pack(Repository src, RevObject... list)
|
||||
throws IOException {
|
||||
try (PackWriter pw = new PackWriter(src)) {
|
||||
for (final RevObject o : list) {
|
||||
|
@ -233,7 +233,7 @@ private File[] pack(final Repository src, final RevObject... list)
|
|||
}
|
||||
}
|
||||
|
||||
private static void write(final File[] files, final PackWriter pw)
|
||||
private static void write(File[] files, PackWriter pw)
|
||||
throws IOException {
|
||||
final long begin = files[0].getParentFile().lastModified();
|
||||
NullProgressMonitor m = NullProgressMonitor.INSTANCE;
|
||||
|
@ -251,7 +251,7 @@ private static void write(final File[] files, final PackWriter pw)
|
|||
touch(begin, files[0].getParentFile());
|
||||
}
|
||||
|
||||
private static void delete(final File[] list) throws IOException {
|
||||
private static void delete(File[] list) throws IOException {
|
||||
final long begin = list[0].getParentFile().lastModified();
|
||||
for (final File f : list) {
|
||||
FileUtils.delete(f);
|
||||
|
@ -260,7 +260,7 @@ private static void delete(final File[] list) throws IOException {
|
|||
touch(begin, list[0].getParentFile());
|
||||
}
|
||||
|
||||
private static void touch(final long begin, final File dir) {
|
||||
private static void touch(long begin, File dir) {
|
||||
while (begin >= dir.lastModified()) {
|
||||
try {
|
||||
Thread.sleep(25);
|
||||
|
@ -271,12 +271,12 @@ private static void touch(final long begin, final File dir) {
|
|||
}
|
||||
}
|
||||
|
||||
private File fullPackFileName(final ObjectId name, final String suffix) {
|
||||
private File fullPackFileName(ObjectId name, String suffix) {
|
||||
final File packdir = db.getObjectDatabase().getPackDirectory();
|
||||
return new File(packdir, "pack-" + name.name() + suffix);
|
||||
}
|
||||
|
||||
private RevObject writeBlob(final Repository repo, final String data)
|
||||
private RevObject writeBlob(Repository repo, String data)
|
||||
throws IOException {
|
||||
final byte[] bytes = Constants.encode(data);
|
||||
final ObjectId id;
|
||||
|
|
|
@ -367,7 +367,7 @@ private static void objectHeader(TemporaryBuffer.Heap pack, int type, int sz)
|
|||
pack.write(buf, 0, n);
|
||||
}
|
||||
|
||||
private static void deflate(TemporaryBuffer.Heap pack, final byte[] content)
|
||||
private static void deflate(TemporaryBuffer.Heap pack, byte[] content)
|
||||
throws IOException {
|
||||
final Deflater deflater = new Deflater();
|
||||
final byte[] buf = new byte[128];
|
||||
|
|
|
@ -835,7 +835,7 @@ private void createVerifyOpenPack(final Set<ObjectId> interestings,
|
|||
verifyOpenPack(thin);
|
||||
}
|
||||
|
||||
private void createVerifyOpenPack(final List<RevObject> objectSource)
|
||||
private void createVerifyOpenPack(List<RevObject> objectSource)
|
||||
throws MissingObjectException, IOException {
|
||||
NullProgressMonitor m = NullProgressMonitor.INSTANCE;
|
||||
writer = new PackWriter(config, db.newObjectReader());
|
||||
|
@ -846,7 +846,7 @@ private void createVerifyOpenPack(final List<RevObject> objectSource)
|
|||
verifyOpenPack(false);
|
||||
}
|
||||
|
||||
private void verifyOpenPack(final boolean thin) throws IOException {
|
||||
private void verifyOpenPack(boolean thin) throws IOException {
|
||||
final byte[] packData = os.toByteArray();
|
||||
|
||||
if (thin) {
|
||||
|
@ -868,13 +868,13 @@ private void verifyOpenPack(final boolean thin) throws IOException {
|
|||
assertNotNull("have PackFile after parsing", pack);
|
||||
}
|
||||
|
||||
private PackParser index(final byte[] packData) throws IOException {
|
||||
private PackParser index(byte[] packData) throws IOException {
|
||||
if (inserter == null)
|
||||
inserter = dst.newObjectInserter();
|
||||
return inserter.newPackParser(new ByteArrayInputStream(packData));
|
||||
}
|
||||
|
||||
private void verifyObjectsOrder(final ObjectId objectsOrder[]) {
|
||||
private void verifyObjectsOrder(ObjectId objectsOrder[]) {
|
||||
final List<PackIndex.MutableEntry> entries = new ArrayList<>();
|
||||
|
||||
for (MutableEntry me : pack) {
|
||||
|
|
|
@ -93,13 +93,13 @@ private void writeSymref(String src, String dst) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private RefUpdate updateRef(final String name) throws IOException {
|
||||
private RefUpdate updateRef(String name) throws IOException {
|
||||
final RefUpdate ref = db.updateRef(name);
|
||||
ref.setNewObjectId(db.resolve(Constants.HEAD));
|
||||
return ref;
|
||||
}
|
||||
|
||||
private void delete(final RefUpdate ref, final Result expected)
|
||||
private void delete(RefUpdate ref, Result expected)
|
||||
throws IOException {
|
||||
delete(ref, expected, true, true);
|
||||
}
|
||||
|
|
|
@ -747,7 +747,7 @@ private ObjectId insertTree(TreeFormatter tree) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private ObjectId insertCommit(final CommitBuilder builder)
|
||||
private ObjectId insertCommit(CommitBuilder builder)
|
||||
throws IOException, UnsupportedEncodingException {
|
||||
try (ObjectInserter oi = db.newObjectInserter()) {
|
||||
ObjectId id = oi.insert(builder);
|
||||
|
@ -764,7 +764,7 @@ private RevCommit parseCommit(AnyObjectId id)
|
|||
}
|
||||
}
|
||||
|
||||
private ObjectId insertTag(final TagBuilder tag) throws IOException,
|
||||
private ObjectId insertTag(TagBuilder tag) throws IOException,
|
||||
UnsupportedEncodingException {
|
||||
try (ObjectInserter oi = db.newObjectInserter()) {
|
||||
ObjectId id = oi.insert(tag);
|
||||
|
|
|
@ -124,7 +124,7 @@ public void testCache_TooSmallLimit() throws IOException {
|
|||
checkLimits(cfg);
|
||||
}
|
||||
|
||||
private static void checkLimits(final WindowCacheConfig cfg) {
|
||||
private static void checkLimits(WindowCacheConfig cfg) {
|
||||
final WindowCache cache = WindowCache.getInstance();
|
||||
assertTrue(cache.getOpenFiles() <= cfg.getPackedGitOpenFiles());
|
||||
assertTrue(cache.getOpenBytes() <= cfg.getPackedGitLimit());
|
||||
|
|
|
@ -631,7 +631,7 @@ private static ReceiveCommand command(AnyObjectId a, AnyObjectId b,
|
|||
name);
|
||||
}
|
||||
|
||||
private void symref(final String name, final String dst)
|
||||
private void symref(String name, String dst)
|
||||
throws IOException {
|
||||
commit(new Function() {
|
||||
@Override
|
||||
|
@ -648,7 +648,7 @@ public boolean apply(ObjectReader reader, RefTree tree)
|
|||
});
|
||||
}
|
||||
|
||||
private void update(final String name, final ObjectId id)
|
||||
private void update(String name, ObjectId id)
|
||||
throws IOException {
|
||||
commit(new Function() {
|
||||
@Override
|
||||
|
|
|
@ -160,7 +160,7 @@ public void isRebase() {
|
|||
assertTrue(new BranchConfig(c, "true").isRebase());
|
||||
}
|
||||
|
||||
private static Config parse(final String content) {
|
||||
private static Config parse(String content) {
|
||||
final Config c = new Config(null);
|
||||
try {
|
||||
c.fromText(content);
|
||||
|
|
|
@ -914,12 +914,12 @@ private static void assertReadLong(long exp, String act)
|
|||
assertEquals(exp, c.getLong("s", null, "a", 0L));
|
||||
}
|
||||
|
||||
private static Config parse(final String content)
|
||||
private static Config parse(String content)
|
||||
throws ConfigInvalidException {
|
||||
return parse(content, null);
|
||||
}
|
||||
|
||||
private static Config parse(final String content, Config baseConfig)
|
||||
private static Config parse(String content, Config baseConfig)
|
||||
throws ConfigInvalidException {
|
||||
final Config c = new Config(baseConfig);
|
||||
c.fromText(content);
|
||||
|
|
|
@ -1607,7 +1607,7 @@ private void checkOneName(String name) throws CorruptObjectException {
|
|||
checker.checkTree(encodeASCII(b.toString()));
|
||||
}
|
||||
|
||||
private static void entry(StringBuilder b, final String modeName) {
|
||||
private static void entry(StringBuilder b, String modeName) {
|
||||
b.append(modeName);
|
||||
b.append('\0');
|
||||
for (int i = 0; i < OBJECT_ID_LENGTH; i++)
|
||||
|
@ -1647,7 +1647,7 @@ private void assertSkipListRejects(String msg, int type, byte[] data) {
|
|||
checker.setSkipList(null);
|
||||
}
|
||||
|
||||
private static ObjectIdSet set(final ObjectId... ids) {
|
||||
private static ObjectIdSet set(ObjectId... ids) {
|
||||
return new ObjectIdSet() {
|
||||
@Override
|
||||
public boolean contains(AnyObjectId objectId) {
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
import org.junit.Test;
|
||||
|
||||
public class ValidRefNameTest {
|
||||
private static void assertValid(final boolean exp, final String name) {
|
||||
private static void assertValid(boolean exp, String name) {
|
||||
SystemReader instance = SystemReader.getInstance();
|
||||
try {
|
||||
setUnixSystemReader();
|
||||
|
@ -81,7 +81,7 @@ private static void setUnixSystemReader() {
|
|||
});
|
||||
}
|
||||
|
||||
private static void assertInvalidOnWindows(final String name) {
|
||||
private static void assertInvalidOnWindows(String name) {
|
||||
SystemReader instance = SystemReader.getInstance();
|
||||
try {
|
||||
setUnixSystemReader();
|
||||
|
|
|
@ -183,7 +183,7 @@ public void testRevert() throws Exception {
|
|||
assertFalse(tw.next());
|
||||
}
|
||||
|
||||
private static void assertCorrectId(final DirCache treeT, final TreeWalk tw) {
|
||||
private static void assertCorrectId(DirCache treeT, TreeWalk tw) {
|
||||
assertEquals(treeT.getEntry(tw.getPathString()).getObjectId(), tw
|
||||
.getObjectId(0));
|
||||
}
|
||||
|
|
|
@ -783,7 +783,7 @@ void modifyIndex(IndexState indexState, String path, String other)
|
|||
}
|
||||
}
|
||||
|
||||
private void setIndex(final ObjectId id, String path)
|
||||
private void setIndex(ObjectId id, String path)
|
||||
throws MissingObjectException, IOException {
|
||||
DirCache lockedDircache;
|
||||
DirCacheEditor dcedit;
|
||||
|
|
|
@ -403,7 +403,7 @@ public void testTrivialTwoWay_rightDFconflict2() throws Exception {
|
|||
assertFalse(merge);
|
||||
}
|
||||
|
||||
private static void assertCorrectId(final DirCache treeT, final TreeWalk tw) {
|
||||
private static void assertCorrectId(DirCache treeT, TreeWalk tw) {
|
||||
assertEquals(treeT.getEntry(tw.getPathString()).getObjectId(), tw
|
||||
.getObjectId(0));
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ public void testTypes() throws IOException {
|
|||
assertEquals(new Edit(23 - 1, 25 - 1, 22 - 1, 28 - 1), e.get(2));
|
||||
}
|
||||
|
||||
private Patch parseTestPatchFile(final String patchFile) throws IOException {
|
||||
private Patch parseTestPatchFile(String patchFile) throws IOException {
|
||||
try (InputStream in = getClass().getResourceAsStream(patchFile)) {
|
||||
if (in == null) {
|
||||
fail("No " + patchFile + " test vector");
|
||||
|
|
|
@ -433,30 +433,30 @@ public void testParseAbbrIndexLine_NoMode() {
|
|||
assertTrue(ObjectId.fromString(nid).startsWith(fh.getNewId()));
|
||||
}
|
||||
|
||||
private static void assertParse(final FileHeader fh) {
|
||||
private static void assertParse(FileHeader fh) {
|
||||
int ptr = fh.parseGitFileName(0, fh.buf.length);
|
||||
assertTrue(ptr > 0);
|
||||
ptr = fh.parseGitHeaders(ptr, fh.buf.length);
|
||||
assertTrue(ptr > 0);
|
||||
}
|
||||
|
||||
private static FileHeader data(final String in) {
|
||||
private static FileHeader data(String in) {
|
||||
return new FileHeader(Constants.encodeASCII(in), 0);
|
||||
}
|
||||
|
||||
private static FileHeader header(final String path) {
|
||||
private static FileHeader header(String path) {
|
||||
return data(gitLine(path) + "--- " + path + "\n");
|
||||
}
|
||||
|
||||
private static String gitLine(final String path) {
|
||||
private static String gitLine(String path) {
|
||||
return "a/" + path + " b/" + path + "\n";
|
||||
}
|
||||
|
||||
private static FileHeader dqHeader(final String path) {
|
||||
private static FileHeader dqHeader(String path) {
|
||||
return data(dqGitLine(path) + "--- " + path + "\n");
|
||||
}
|
||||
|
||||
private static String dqGitLine(final String path) {
|
||||
private static String dqGitLine(String path) {
|
||||
return "\"a/" + path + "\" \"b/" + path + "\"\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ private Patch parseTestPatchFile() throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private String readTestPatchFile(final Charset cs) throws IOException {
|
||||
private String readTestPatchFile(Charset cs) throws IOException {
|
||||
final String patchFile = JGitTestUtil.getName() + ".patch";
|
||||
try (InputStream in = getClass().getResourceAsStream(patchFile)) {
|
||||
if (in == null) {
|
||||
|
|
|
@ -353,7 +353,7 @@ public void testMatchesBugId() throws IOException {
|
|||
assertFalse("not CC", line.matches(FooterKey.CC));
|
||||
}
|
||||
|
||||
private RevCommit parse(final String msg) throws IOException {
|
||||
private RevCommit parse(String msg) throws IOException {
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append("tree " + ObjectId.zeroId().name() + "\n");
|
||||
buf.append("author A. U. Thor <a@example.com> 1 +0000\n");
|
||||
|
|
|
@ -138,7 +138,7 @@ public void testParse_NoParents() throws Exception {
|
|||
assertEquals(TimeZone.getTimeZone("GMT" + committerTimeZone), cCommitter.getTimeZone());
|
||||
}
|
||||
|
||||
private RevCommit create(final String msg) throws Exception {
|
||||
private RevCommit create(String msg) throws Exception {
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append("tree 9788669ad918b6fcce64af8882fc9a81cb6aba67\n");
|
||||
b.append("author A U. Thor <a_u_thor@example.com> 1218123387 +0700\n");
|
||||
|
@ -483,7 +483,7 @@ public void testParse_GitStyleMessageWithCRLF() throws Exception {
|
|||
assertEquals(shortMsg, c.getShortMessage());
|
||||
}
|
||||
|
||||
private static ObjectId id(final String str) {
|
||||
private static ObjectId id(String str) {
|
||||
return ObjectId.fromString(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public void testTagTag() throws Exception {
|
|||
testOneType(Constants.OBJ_TAG);
|
||||
}
|
||||
|
||||
private void testOneType(final int typeCode) throws Exception {
|
||||
private void testOneType(int typeCode) throws Exception {
|
||||
final ObjectId id = id("9788669ad918b6fcce64af8882fc9a81cb6aba67");
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append("object " + id.name() + "\n");
|
||||
|
@ -202,7 +202,7 @@ public void testParseOldStyleNoTagger() throws Exception {
|
|||
assertNull(c.getTaggerIdent());
|
||||
}
|
||||
|
||||
private RevTag create(final String msg) throws Exception {
|
||||
private RevTag create(String msg) throws Exception {
|
||||
final StringBuilder b = new StringBuilder();
|
||||
b.append("object 9788669ad918b6fcce64af8882fc9a81cb6aba67\n");
|
||||
b.append("type tree\n");
|
||||
|
@ -480,7 +480,7 @@ public void testParse_PublicParseMethod() throws CorruptObjectException {
|
|||
assertEquals(src.getMessage(), p.getFullMessage());
|
||||
}
|
||||
|
||||
private static ObjectId id(final String str) {
|
||||
private static ObjectId id(String str) {
|
||||
return ObjectId.fromString(str);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public void setUp() throws Exception {
|
|||
diffCollector = new DiffCollector();
|
||||
}
|
||||
|
||||
protected FollowFilter follow(final String followPath) {
|
||||
protected FollowFilter follow(String followPath) {
|
||||
FollowFilter followFilter =
|
||||
FollowFilter.create(followPath, new Config().get(DiffConfig.KEY));
|
||||
followFilter.setRenameCallback(diffCollector);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
import org.junit.Test;
|
||||
|
||||
public class RevWalkPathFilter1Test extends RevWalkTestCase {
|
||||
protected void filter(final String path) {
|
||||
protected void filter(String path) {
|
||||
rw.setTreeFilter(AndTreeFilter.create(PathFilterGroup
|
||||
.createFromStrings(Collections.singleton(path)),
|
||||
TreeFilter.ANY_DIFF));
|
||||
|
|
|
@ -102,7 +102,7 @@ public void setUp() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
protected void check(final RevCommit... order) throws Exception {
|
||||
protected void check(RevCommit... order) throws Exception {
|
||||
markStart(i);
|
||||
final StringBuilder act = new StringBuilder();
|
||||
for (final RevCommit z : rw) {
|
||||
|
@ -121,7 +121,7 @@ protected void check(final RevCommit... order) throws Exception {
|
|||
assertEquals(exp.toString(), act.toString());
|
||||
}
|
||||
|
||||
protected void filter(final String path) {
|
||||
protected void filter(String path) {
|
||||
rw.setTreeFilter(AndTreeFilter.create(PathFilterGroup
|
||||
.createFromStrings(Collections.singleton(path)),
|
||||
TreeFilter.ANY_DIFF));
|
||||
|
|
|
@ -74,38 +74,38 @@ protected Date getDate() {
|
|||
return util.getDate();
|
||||
}
|
||||
|
||||
protected void tick(final int secDelta) {
|
||||
protected void tick(int secDelta) {
|
||||
util.tick(secDelta);
|
||||
}
|
||||
|
||||
protected RevBlob blob(final String content) throws Exception {
|
||||
protected RevBlob blob(String content) throws Exception {
|
||||
return util.blob(content);
|
||||
}
|
||||
|
||||
protected DirCacheEntry file(final String path, final RevBlob blob)
|
||||
protected DirCacheEntry file(String path, RevBlob blob)
|
||||
throws Exception {
|
||||
return util.file(path, blob);
|
||||
}
|
||||
|
||||
protected RevTree tree(final DirCacheEntry... entries) throws Exception {
|
||||
protected RevTree tree(DirCacheEntry... entries) throws Exception {
|
||||
return util.tree(entries);
|
||||
}
|
||||
|
||||
protected RevObject get(final RevTree tree, final String path)
|
||||
protected RevObject get(RevTree tree, String path)
|
||||
throws Exception {
|
||||
return util.get(tree, path);
|
||||
}
|
||||
|
||||
protected RevCommit commit(final RevCommit... parents) throws Exception {
|
||||
protected RevCommit commit(RevCommit... parents) throws Exception {
|
||||
return util.commit(parents);
|
||||
}
|
||||
|
||||
protected RevCommit commit(final RevTree tree, final RevCommit... parents)
|
||||
protected RevCommit commit(RevTree tree, RevCommit... parents)
|
||||
throws Exception {
|
||||
return util.commit(tree, parents);
|
||||
}
|
||||
|
||||
protected RevCommit commit(final int secDelta, final RevCommit... parents)
|
||||
protected RevCommit commit(int secDelta, RevCommit... parents)
|
||||
throws Exception {
|
||||
return util.commit(secDelta, parents);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ protected RevCommit commit(final int secDelta, final RevTree tree,
|
|||
return util.commit(secDelta, tree, parents);
|
||||
}
|
||||
|
||||
protected RevTag tag(final String name, final RevObject dst)
|
||||
protected RevTag tag(String name, RevObject dst)
|
||||
throws Exception {
|
||||
return util.tag(name, dst);
|
||||
}
|
||||
|
@ -125,19 +125,19 @@ protected CommitBuilder commitBuilder()
|
|||
return util.commit();
|
||||
}
|
||||
|
||||
protected <T extends RevObject> T parseBody(final T t) throws Exception {
|
||||
protected <T extends RevObject> T parseBody(T t) throws Exception {
|
||||
return util.parseBody(t);
|
||||
}
|
||||
|
||||
protected void markStart(final RevCommit commit) throws Exception {
|
||||
protected void markStart(RevCommit commit) throws Exception {
|
||||
rw.markStart(commit);
|
||||
}
|
||||
|
||||
protected void markUninteresting(final RevCommit commit) throws Exception {
|
||||
protected void markUninteresting(RevCommit commit) throws Exception {
|
||||
rw.markUninteresting(commit);
|
||||
}
|
||||
|
||||
protected void assertCommit(final RevCommit exp, final RevCommit act) {
|
||||
protected void assertCommit(RevCommit exp, RevCommit act) {
|
||||
assertSame(exp, act);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public void withCommitLoadedByDifferentRevWalk() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
private Ref branch(final String name, final RevCommit dst) throws Exception {
|
||||
private Ref branch(String name, RevCommit dst) throws Exception {
|
||||
return Git.wrap(db).branchCreate().setName(name)
|
||||
.setStartPoint(dst.name()).call();
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ public void setUp() throws Exception {
|
|||
configFile = new File(home, ".netrc");
|
||||
}
|
||||
|
||||
private void config(final String data) throws IOException {
|
||||
private void config(String data) throws IOException {
|
||||
try (OutputStreamWriter fw = new OutputStreamWriter(
|
||||
new FileOutputStream(configFile), CHARSET)) {
|
||||
fw.write(data);
|
||||
|
|
|
@ -90,7 +90,7 @@ public void setUp() throws Exception {
|
|||
osc = new OpenSshConfig(home, configFile);
|
||||
}
|
||||
|
||||
private void config(final String data) throws IOException {
|
||||
private void config(String data) throws IOException {
|
||||
long lastMtime = configFile.lastModified();
|
||||
do {
|
||||
try (final OutputStreamWriter fw = new OutputStreamWriter(
|
||||
|
|
|
@ -326,7 +326,7 @@ public void testReadACK_ERR() throws IOException {
|
|||
|
||||
// test support
|
||||
|
||||
private void init(final String msg) {
|
||||
private void init(String msg) {
|
||||
rawIn = new ByteArrayInputStream(Constants.encodeASCII(msg));
|
||||
in = new PacketLineIn(rawIn);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public void flush() throws IOException {
|
|||
assertEquals(1, flushCnt[0]);
|
||||
}
|
||||
|
||||
private void assertBuffer(final String exp) throws IOException {
|
||||
private void assertBuffer(String exp) throws IOException {
|
||||
assertEquals(exp, new String(rawOut.toByteArray(),
|
||||
Constants.CHARACTER_ENCODING));
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue