* [EGIT PATCH 00/10] JGit cleanups @ 2009-03-16 20:14 Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 01/10] Require javadoc on protected methods in jgit core Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg Getting annoyed with all the noise I came up with series of cleanups. The hunk parsing fixes are the one's I'm not really sure about, but my attempts to find a case that would give an uncontrolled error did not find much success. -- robin Robin Rosenberg (10): Require javadoc on protected methods in jgit core Rename the objectsUrl in the nested HttpObjectDB to Rename variables that hides others with different content in FetchProcess Rename a parameter i PackWriter that hides another with the same name Rename fields to avoid hiding of field names in ReadTreeTest Rename the gitDir fields to indicate they refer to another dir than the default Rename a parameter in PushProcessTest that hides another Drop unused end parameters in hunk parsing code Drop unused File arguments in IndexTreeWalker and WorkdirCheckout Drop an effectively unused parameter in IndexTreeWalker. .../.settings/org.eclipse.jdt.core.prefs | 7 +- .../src/org/spearce/jgit/pgm/ReceivePack.java | 10 +- .../src/org/spearce/jgit/pgm/TextBuiltin.java | 9 +- .../src/org/spearce/jgit/pgm/UploadPack.java | 10 +- .../tst/org/spearce/jgit/lib/ReadTreeTest.java | 118 ++++++++++---------- .../spearce/jgit/transport/PushProcessTest.java | 4 +- .../.settings/org.eclipse.jdt.core.prefs | 5 +- .../jgit/dircache/DirCacheBuildIterator.java | 2 +- .../spearce/jgit/dircache/DirCacheIterator.java | 2 +- .../src/org/spearce/jgit/lib/IndexTreeWalker.java | 12 +- .../src/org/spearce/jgit/lib/ObjectId.java | 2 +- .../src/org/spearce/jgit/lib/PackIndex.java | 6 +- .../src/org/spearce/jgit/lib/PackWriter.java | 8 +- .../jgit/lib/TreeVisitorWithCurrentDirectory.java | 4 +- .../src/org/spearce/jgit/lib/WorkDirCheckout.java | 17 ++-- .../org/spearce/jgit/merge/StrategyOneSided.java | 2 +- .../org/spearce/jgit/patch/CombinedHunkHeader.java | 2 +- .../src/org/spearce/jgit/patch/FileHeader.java | 18 ++-- .../src/org/spearce/jgit/patch/HunkHeader.java | 6 +- .../src/org/spearce/jgit/patch/Patch.java | 8 +- .../org/spearce/jgit/revplot/PlotCommitList.java | 9 ++ .../src/org/spearce/jgit/revplot/PlotWalk.java | 4 + .../org/spearce/jgit/transport/DaemonService.java | 4 +- .../org/spearce/jgit/transport/FetchProcess.java | 8 +- .../org/spearce/jgit/transport/OpenSshConfig.java | 2 +- .../spearce/jgit/transport/OperationResult.java | 10 +- .../spearce/jgit/transport/PackedObjectInfo.java | 2 +- .../src/org/spearce/jgit/transport/PushResult.java | 2 +- .../spearce/jgit/transport/RemoteRefUpdate.java | 6 +- .../org/spearce/jgit/transport/TransportHttp.java | 14 +- .../spearce/jgit/treewalk/WorkingTreeIterator.java | 7 + 31 files changed, 173 insertions(+), 147 deletions(-) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [EGIT PATCH 01/10] Require javadoc on protected methods in jgit core 2009-03-16 20:14 [EGIT PATCH 00/10] JGit cleanups Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg In general protected methods are part of a public API since they grant access to code outside of the package that declares the method or field. A few protected fields and methods do not have javadocs, but it turns out all but one are not used outside the package that declares them so we can simply make them package private. This doesn't mean they aren't supposed to be an API, but we can upgrade them if necessary. A few places are actually used outside the package and are valid uses. For those appropriate javadocs are added. Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> --- .../.settings/org.eclipse.jdt.core.prefs | 7 ++++--- .../src/org/spearce/jgit/pgm/TextBuiltin.java | 9 +++++++-- .../.settings/org.eclipse.jdt.core.prefs | 5 +++-- .../jgit/dircache/DirCacheBuildIterator.java | 2 +- .../spearce/jgit/dircache/DirCacheIterator.java | 2 +- .../src/org/spearce/jgit/lib/ObjectId.java | 2 +- .../src/org/spearce/jgit/lib/PackIndex.java | 6 +++--- .../src/org/spearce/jgit/lib/PackWriter.java | 2 +- .../jgit/lib/TreeVisitorWithCurrentDirectory.java | 4 ++-- .../src/org/spearce/jgit/lib/WorkDirCheckout.java | 14 +++++++------- .../org/spearce/jgit/merge/StrategyOneSided.java | 2 +- .../src/org/spearce/jgit/patch/FileHeader.java | 18 +++++++++--------- .../src/org/spearce/jgit/patch/HunkHeader.java | 4 ++-- .../org/spearce/jgit/revplot/PlotCommitList.java | 9 +++++++++ .../src/org/spearce/jgit/revplot/PlotWalk.java | 4 ++++ .../org/spearce/jgit/transport/DaemonService.java | 4 ++-- .../org/spearce/jgit/transport/OpenSshConfig.java | 2 +- .../spearce/jgit/transport/OperationResult.java | 10 +++++----- .../spearce/jgit/transport/PackedObjectInfo.java | 2 +- .../src/org/spearce/jgit/transport/PushResult.java | 2 +- .../spearce/jgit/transport/RemoteRefUpdate.java | 6 +++--- .../spearce/jgit/treewalk/WorkingTreeIterator.java | 7 +++++++ 22 files changed, 75 insertions(+), 48 deletions(-) diff --git a/org.spearce.jgit.pgm/.settings/org.eclipse.jdt.core.prefs b/org.spearce.jgit.pgm/.settings/org.eclipse.jdt.core.prefs index a67b954..f0c80d3 100644 --- a/org.spearce.jgit.pgm/.settings/org.eclipse.jdt.core.prefs +++ b/org.spearce.jgit.pgm/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Sun Feb 03 03:16:45 CET 2008 +#Sun Mar 15 19:46:39 CET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -36,10 +36,11 @@ org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/TextBuiltin.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/TextBuiltin.java index d3e32b3..0cbd0d9 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/TextBuiltin.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/TextBuiltin.java @@ -207,18 +207,23 @@ public Repository getRepository() { return db; } - protected ObjectId resolve(final String s) throws IOException { + ObjectId resolve(final String s) throws IOException { final ObjectId r = db.resolve(s); if (r == null) throw die("Not a revision: " + s); return r; } + /** + * @param why + * textual explanation + * @return a runtime exception the caller is expected to throw + */ protected static Die die(final String why) { return new Die(why); } - protected String abbreviateRef(String dst, boolean abbreviateRemote) { + String abbreviateRef(String dst, boolean abbreviateRemote) { if (dst.startsWith(R_HEADS)) dst = dst.substring(R_HEADS.length()); else if (dst.startsWith(R_TAGS)) diff --git a/org.spearce.jgit/.settings/org.eclipse.jdt.core.prefs b/org.spearce.jgit/.settings/org.eclipse.jdt.core.prefs index a67b954..8e8e172 100644 --- a/org.spearce.jgit/.settings/org.eclipse.jdt.core.prefs +++ b/org.spearce.jgit/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,4 @@ -#Sun Feb 03 03:16:45 CET 2008 +#Sun Mar 15 01:13:43 CET 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 @@ -36,7 +36,8 @@ org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private diff --git a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheBuildIterator.java b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheBuildIterator.java index 234ffd2..9818b76 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheBuildIterator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheBuildIterator.java @@ -91,7 +91,7 @@ public DirCacheBuildIterator(final DirCacheBuilder dcb) { builder = dcb; } - protected DirCacheBuildIterator(final DirCacheBuildIterator p, + DirCacheBuildIterator(final DirCacheBuildIterator p, final DirCacheTree dct) { super(p, dct); builder = p.builder; diff --git a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheIterator.java b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheIterator.java index 8384723..356d735 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheIterator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/dircache/DirCacheIterator.java @@ -105,7 +105,7 @@ public DirCacheIterator(final DirCache dc) { parseEntry(); } - protected DirCacheIterator(final DirCacheIterator p, final DirCacheTree dct) { + DirCacheIterator(final DirCacheIterator p, final DirCacheTree dct) { super(p, p.path, p.pathLen + 1); cache = p.cache; tree = dct; diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectId.java index 52ce0d4..fde209b 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectId.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/ObjectId.java @@ -238,7 +238,7 @@ private static final ObjectId fromHexString(final byte[] bs, int p) { } } - protected ObjectId(final int new_1, final int new_2, final int new_3, + ObjectId(final int new_1, final int new_2, final int new_3, final int new_4, final int new_5) { w1 = new_1; w2 = new_2; diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java index 473ce1e..b8e7447 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackIndex.java @@ -243,7 +243,7 @@ abstract long findCRC32(AnyObjectId objId) throws MissingObjectException, * */ public static class MutableEntry { - protected final MutableObjectId idBuffer = new MutableObjectId(); + final MutableObjectId idBuffer = new MutableObjectId(); long offset; @@ -281,12 +281,12 @@ public MutableEntry cloneEntry() { return r; } - protected void ensureId() { + void ensureId() { // Override in implementations. } } - protected abstract class EntriesIterator implements Iterator<MutableEntry> { + abstract class EntriesIterator implements Iterator<MutableEntry> { protected final MutableEntry entry = initEntry(); protected long returnedNumber = 0; diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java index b878409..2183872 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java @@ -931,7 +931,7 @@ boolean isDeltaRepresentation() { * @return true if object is already written; false otherwise. */ boolean isWritten() { - return offset != 0; + return getOffset() != 0; } PackedObjectLoader getReuseLoader() { diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java index e227adb..3e1e1ea 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/TreeVisitorWithCurrentDirectory.java @@ -50,11 +50,11 @@ private File currentDirectory; - protected TreeVisitorWithCurrentDirectory(final File rootDirectory) { + TreeVisitorWithCurrentDirectory(final File rootDirectory) { currentDirectory = rootDirectory; } - protected File getCurrentDirectory() { + File getCurrentDirectory() { return currentDirectory; } diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java index 15e00df..d3da74a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java @@ -56,15 +56,15 @@ * Three-way merges are no performed. See {@link #setFailOnConflict(boolean)}. */ public class WorkDirCheckout { - protected Repository repo; + Repository repo; - protected File root; + File root; - protected GitIndex index; + GitIndex index; private boolean failOnConflict = true; - protected Tree merge; + Tree merge; /** @@ -151,9 +151,9 @@ private void checkoutTwoTrees() throws FileNotFoundException, IOException { ArrayList<String> conflicts = new ArrayList<String>(); ArrayList<String> removed = new ArrayList<String>(); - protected Tree head = null; + Tree head = null; - protected HashMap<String, ObjectId> updated = new HashMap<String, ObjectId>(); + HashMap<String, ObjectId> updated = new HashMap<String, ObjectId>(); private void checkoutOutIndexNoHead() throws IOException { new IndexTreeWalker(index, merge, root, new AbstractIndexTreeVisitor() { @@ -294,7 +294,7 @@ else if (file.isDirectory()) { conflicts.removeAll(removed); } - protected void processEntry(TreeEntry h, TreeEntry m, Entry i, + void processEntry(TreeEntry h, TreeEntry m, Entry i, File file) throws IOException { ObjectId iId = (i == null ? null : i.getObjectId()); ObjectId mId = (m == null ? null : m.getId()); diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategyOneSided.java b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategyOneSided.java index 8677b28..c594daa 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategyOneSided.java +++ b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategyOneSided.java @@ -77,7 +77,7 @@ public Merger newMerger(final Repository db) { return new OneSide(db, treeIndex); } - protected static class OneSide extends Merger { + static class OneSide extends Merger { private final int treeIndex; protected OneSide(final Repository local, final int index) { diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java b/org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java index e6cccb2..7d341d8 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/FileHeader.java @@ -68,9 +68,9 @@ private static final byte[] NEW_MODE = encodeASCII("new mode "); - protected static final byte[] DELETED_FILE_MODE = encodeASCII("deleted file mode "); + static final byte[] DELETED_FILE_MODE = encodeASCII("deleted file mode "); - protected static final byte[] NEW_FILE_MODE = encodeASCII("new file mode "); + static final byte[] NEW_FILE_MODE = encodeASCII("new file mode "); private static final byte[] COPY_FROM = encodeASCII("copy from "); @@ -88,7 +88,7 @@ private static final byte[] DISSIMILARITY_INDEX = encodeASCII("dissimilarity index "); - protected static final byte[] INDEX = encodeASCII("index "); + static final byte[] INDEX = encodeASCII("index "); static final byte[] OLD_NAME = encodeASCII("--- "); @@ -220,7 +220,7 @@ public String getScriptText(Charset oldCharset, Charset newCharset) { return getScriptText(new Charset[] { oldCharset, newCharset }); } - protected String getScriptText(Charset[] charsetGuess) { + String getScriptText(Charset[] charsetGuess) { if (getHunks().isEmpty()) { // If we have no hunks then we can safely assume the entire // patch is a binary style patch, or a meta-data only style @@ -562,19 +562,19 @@ int parseGitHeaders(int ptr, final int end) { return ptr; } - protected void parseOldName(int ptr, final int eol) { + void parseOldName(int ptr, final int eol) { oldName = p1(parseName(oldName, ptr + OLD_NAME.length, eol)); if (oldName == DEV_NULL) changeType = ChangeType.ADD; } - protected void parseNewName(int ptr, final int eol) { + void parseNewName(int ptr, final int eol) { newName = p1(parseName(newName, ptr + NEW_NAME.length, eol)); if (newName == DEV_NULL) changeType = ChangeType.DELETE; } - protected void parseNewFileMode(int ptr, final int eol) { + void parseNewFileMode(int ptr, final int eol) { oldMode = FileMode.MISSING; newMode = parseFileMode(ptr + NEW_FILE_MODE.length, eol); changeType = ChangeType.ADD; @@ -633,7 +633,7 @@ private static String p1(final String r) { return s > 0 ? r.substring(s + 1) : r; } - protected FileMode parseFileMode(int ptr, final int end) { + FileMode parseFileMode(int ptr, final int end) { int tmp = 0; while (ptr < end - 1) { tmp <<= 3; @@ -642,7 +642,7 @@ protected FileMode parseFileMode(int ptr, final int end) { return FileMode.fromBits(tmp); } - protected void parseIndexLine(int ptr, final int end) { + void parseIndexLine(int ptr, final int end) { // "index $asha1..$bsha1[ $mode]" where $asha1 and $bsha1 // can be unique abbreviations // diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java index fc30311..e3ce546 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java @@ -307,7 +307,7 @@ void extractFileLines(final StringBuilder sb, final String[] text, } } - protected void copyLine(final StringBuilder sb, final String[] text, + void copyLine(final StringBuilder sb, final String[] text, final int[] offsets, final int fileIdx) { final String s = text[fileIdx]; final int start = offsets[fileIdx]; @@ -320,7 +320,7 @@ protected void copyLine(final StringBuilder sb, final String[] text, offsets[fileIdx] = end; } - protected void skipLine(final String[] text, final int[] offsets, + void skipLine(final String[] text, final int[] offsets, final int fileIdx) { final String s = text[fileIdx]; final int end = s.indexOf('\n', offsets[fileIdx]); diff --git a/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotCommitList.java b/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotCommitList.java index 7e9f509..a0959e2 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotCommitList.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotCommitList.java @@ -171,10 +171,19 @@ private PlotLane nextFreeLane() { return p; } + /** + * @return a new Lane appropriate for this particular PlotList. + */ protected L createLane() { return (L) new PlotLane(); } + /** + * Return colors and other reusable information to the plotter when a lane + * is no longer needed. + * + * @param lane + */ protected void recycleLane(final L lane) { // Nothing. } diff --git a/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotWalk.java b/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotWalk.java index 8801850..f2a5976 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotWalk.java +++ b/org.spearce.jgit/src/org/spearce/jgit/revplot/PlotWalk.java @@ -88,6 +88,10 @@ protected RevCommit createCommit(final AnyObjectId id) { return new PlotCommit(id, getTags(id)); } + /** + * @param commitId + * @return return the list of knows tags referring to this commit + */ protected Ref[] getTags(final AnyObjectId commitId) { Collection<Ref> list = reverseRefMap.get(commitId); Ref[] tags; diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/DaemonService.java b/org.spearce.jgit/src/org/spearce/jgit/transport/DaemonService.java index 4dc11ef..c511d5a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/DaemonService.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/DaemonService.java @@ -51,7 +51,7 @@ private boolean overridable; - protected DaemonService(final String cmdName, final String cfgName) { + DaemonService(final String cmdName, final String cfgName) { command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; config = cfgName; overridable = true; @@ -115,6 +115,6 @@ void execute(final DaemonClient client, final String commandLine) execute(client, db); } - protected abstract void execute(DaemonClient client, Repository db) + abstract void execute(DaemonClient client, Repository db) throws IOException; } diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java b/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java index b08d5c6..0d9f12f 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/OpenSshConfig.java @@ -95,7 +95,7 @@ public static OpenSshConfig get() { /** Cached entries read out of the configuration file. */ private Map<String, Host> hosts; - protected OpenSshConfig(final File h, final File cfg) { + OpenSshConfig(final File h, final File cfg) { home = h; configFile = cfg; hosts = Collections.emptyMap(); diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/OperationResult.java b/org.spearce.jgit/src/org/spearce/jgit/transport/OperationResult.java index f078f39..7b56d8b 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/OperationResult.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/OperationResult.java @@ -53,11 +53,11 @@ */ public abstract class OperationResult { - protected Map<String, Ref> advertisedRefs = Collections.emptyMap(); + Map<String, Ref> advertisedRefs = Collections.emptyMap(); - protected URIish uri; + URIish uri; - protected final SortedMap<String, TrackingRefUpdate> updates = new TreeMap<String, TrackingRefUpdate>(); + final SortedMap<String, TrackingRefUpdate> updates = new TreeMap<String, TrackingRefUpdate>(); /** * Get the URI this result came from. @@ -122,12 +122,12 @@ public TrackingRefUpdate getTrackingRefUpdate(final String localName) { return updates.get(localName); } - protected void setAdvertisedRefs(final URIish u, final Map<String, Ref> ar) { + void setAdvertisedRefs(final URIish u, final Map<String, Ref> ar) { uri = u; advertisedRefs = ar; } - protected void add(final TrackingRefUpdate u) { + void add(final TrackingRefUpdate u) { updates.put(u.getLocalName(), u); } } \ No newline at end of file diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/PackedObjectInfo.java b/org.spearce.jgit/src/org/spearce/jgit/transport/PackedObjectInfo.java index 045b795..f37f421 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/PackedObjectInfo.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/PackedObjectInfo.java @@ -49,7 +49,7 @@ * objects from the pack. This extension of ObjectId includes the offset. */ public class PackedObjectInfo extends ObjectId { - protected long offset; + private long offset; private int crc; diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/PushResult.java b/org.spearce.jgit/src/org/spearce/jgit/transport/PushResult.java index f7fbd58..91f9f69 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/PushResult.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/PushResult.java @@ -77,7 +77,7 @@ public RemoteRefUpdate getRemoteUpdate(final String refName) { return remoteUpdates.get(refName); } - protected void setRemoteUpdates( + void setRemoteUpdates( final Map<String, RemoteRefUpdate> remoteUpdates) { this.remoteUpdates = remoteUpdates; } diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java index c79f7dc..9b054eb 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/RemoteRefUpdate.java @@ -315,15 +315,15 @@ public String getMessage() { return message; } - protected void setStatus(final Status status) { + void setStatus(final Status status) { this.status = status; } - protected void setFastForward(boolean fastForward) { + void setFastForward(boolean fastForward) { this.fastForward = fastForward; } - protected void setMessage(final String message) { + void setMessage(final String message) { this.message = message; } diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java index 07ce2ed..836b01a 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java +++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/WorkingTreeIterator.java @@ -309,6 +309,13 @@ static int lastPathChar(final Entry e) { return e.getMode() == FileMode.TREE ? '/' : '\0'; } + /** + * Constructor helper. + * + * @param list + * files in the subtree of the work tree this iterator operates + * on + */ protected void init(final Entry[] list) { // Filter out nulls, . and .. as these are not valid tree entries, // also cache the encoded forms of the path names for efficient use -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to 2009-03-16 20:14 ` [EGIT PATCH 01/10] Require javadoc on protected methods in jgit core Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess Robin Rosenberg 2009-03-16 20:25 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Shawn O. Pearce 0 siblings, 2 replies; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg It is used for looking at alternate objects, so name it such --- .../org/spearce/jgit/transport/TransportHttp.java | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java index fe4a437..38d26b3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java @@ -112,15 +112,15 @@ public void close() { } class HttpObjectDB extends WalkRemoteObjectDatabase { - private final URL objectsUrl; + private final URL alternateObjectsUrl; HttpObjectDB(final URL b) { - objectsUrl = b; + alternateObjectsUrl = b; } @Override URIish getURI() { - return new URIish(objectsUrl); + return new URIish(alternateObjectsUrl); } @Override @@ -143,7 +143,7 @@ URIish getURI() { @Override WalkRemoteObjectDatabase openAlternate(final String location) throws IOException { - return new HttpObjectDB(new URL(objectsUrl, location)); + return new HttpObjectDB(new URL(alternateObjectsUrl, location)); } @Override @@ -171,7 +171,7 @@ WalkRemoteObjectDatabase openAlternate(final String location) @Override FileStream open(final String path) throws IOException { - final URL base = objectsUrl; + final URL base = alternateObjectsUrl; final URL u = new URL(base, path); final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); final HttpURLConnection c; @@ -201,10 +201,10 @@ FileStream open(final String path) throws IOException { } } catch (IOException err) { try { - throw new TransportException(new URL(objectsUrl, INFO_REFS) + throw new TransportException(new URL(alternateObjectsUrl, INFO_REFS) + ": cannot read available refs", err); } catch (MalformedURLException mue) { - throw new TransportException(objectsUrl + INFO_REFS + throw new TransportException(alternateObjectsUrl + INFO_REFS + ": cannot read available refs", err); } } -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess 2009-03-16 20:14 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 04/10] Rename a parameter i PackWriter that hides another with the same name Robin Rosenberg 2009-03-16 20:25 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Shawn O. Pearce 1 sibling, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../org/spearce/jgit/transport/FetchProcess.java | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java b/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java index df64817..f216cba 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java @@ -298,7 +298,7 @@ private void expandSingle(final RefSpec spec, final Set<Ref> matched) private Collection<Ref> expandAutoFollowTags() throws TransportException { final Collection<Ref> additionalTags = new ArrayList<Ref>(); - final Map<String, Ref> have = transport.local.getAllRefs(); + final Map<String, Ref> haveRefs = transport.local.getAllRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) continue; @@ -307,7 +307,7 @@ private void expandSingle(final RefSpec spec, final Set<Ref> matched) continue; } - final Ref local = have.get(r.getName()); + final Ref local = haveRefs.get(r.getName()); if (local != null) { if (!r.getObjectId().equals(local.getObjectId())) wantTag(r); @@ -321,11 +321,11 @@ private void expandSingle(final RefSpec spec, final Set<Ref> matched) } private void expandFetchTags() throws TransportException { - final Map<String, Ref> have = transport.local.getAllRefs(); + final Map<String, Ref> haveRefs = transport.local.getAllRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) continue; - final Ref local = have.get(r.getName()); + final Ref local = haveRefs.get(r.getName()); if (local == null || !r.getObjectId().equals(local.getObjectId())) wantTag(r); } -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 04/10] Rename a parameter i PackWriter that hides another with the same name 2009-03-16 20:14 ` [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 05/10] Rename fields to avoid hiding of field names in ReadTreeTest Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../src/org/spearce/jgit/lib/PackWriter.java | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java index 2183872..601ce71 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java @@ -447,7 +447,7 @@ public void preparePack(final Iterator<RevObject> objectsSource) * @param uninterestingObjects * collection of objects to be marked as uninteresting (end * points of graph traversal). - * @param thin + * @param packthin * a boolean indicating whether writer may pack objects with * delta base object not within set of objects to pack, but * belonging to party repository (uninteresting/boundary) as @@ -464,9 +464,9 @@ public void preparePack(final Iterator<RevObject> objectsSource) public void preparePack( final Collection<? extends ObjectId> interestingObjects, final Collection<? extends ObjectId> uninterestingObjects, - final boolean thin, final boolean ignoreMissingUninteresting) + final boolean packthin, final boolean ignoreMissingUninteresting) throws IOException { - this.thin = thin; + this.thin = packthin; ObjectWalk walker = setUpWalker(interestingObjects, uninterestingObjects, ignoreMissingUninteresting); findObjectsToPack(walker); -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 05/10] Rename fields to avoid hiding of field names in ReadTreeTest 2009-03-16 20:14 ` [EGIT PATCH 04/10] Rename a parameter i PackWriter that hides another with the same name Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 06/10] Rename the gitDir fields to indicate they refer to another dir than the default Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../tst/org/spearce/jgit/lib/ReadTreeTest.java | 118 ++++++++++---------- 1 files changed, 59 insertions(+), 59 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ReadTreeTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ReadTreeTest.java index 6318633..c9d0565 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ReadTreeTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/ReadTreeTest.java @@ -49,10 +49,10 @@ public class ReadTreeTest extends RepositoryTestCase { - private Tree head; - private Tree merge; - private GitIndex index; - private WorkDirCheckout readTree; + private Tree theHead; + private Tree theMerge; + private GitIndex theIndex; + private WorkDirCheckout theReadTree; // Each of these rules are from the read-tree manpage // go there to see what they mean. // Rule 0 is left out for obvious reasons :) @@ -87,9 +87,9 @@ public void testRules1thru3_NoIndexEntry() throws IOException { void setupCase(HashMap<String, String> headEntries, HashMap<String, String> mergeEntries, HashMap<String, String> indexEntries) throws IOException { - head = buildTree(headEntries); - merge = buildTree(mergeEntries); - index = buildIndex(indexEntries); + theHead = buildTree(headEntries); + theMerge = buildTree(mergeEntries); + theIndex = buildIndex(indexEntries); } private GitIndex buildIndex(HashMap<String, String> indexEntries) throws IOException { @@ -129,9 +129,9 @@ ObjectId genSha1(String data) { } private WorkDirCheckout go() throws IOException { - readTree = new WorkDirCheckout(db, trash, head, index, merge); - readTree.prescanTwoTrees(); - return readTree; + theReadTree = new WorkDirCheckout(db, trash, theHead, theIndex, theMerge); + theReadTree.prescanTwoTrees(); + return theReadTree; } // for these rules, they all have clean yes/no options @@ -144,17 +144,17 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { idxMap = new HashMap<String, String>(); idxMap.put("foo", "foo"); setupCase(null, null, idxMap); - readTree = go(); + theReadTree = go(); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.removed.isEmpty()); - assertTrue(readTree.conflicts.isEmpty()); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.removed.isEmpty()); + assertTrue(theReadTree.conflicts.isEmpty()); // rules 6 and 7 idxMap = new HashMap<String, String>(); idxMap.put("foo", "foo"); setupCase(null, idxMap, idxMap); - readTree = go(); + theReadTree = go(); assertAllEmpty(); @@ -166,9 +166,9 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { setupCase(null, mergeMap, idxMap); go(); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.removed.isEmpty()); - assertTrue(readTree.conflicts.contains("foo")); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.removed.isEmpty()); + assertTrue(theReadTree.conflicts.contains("foo")); // rule 10 @@ -177,29 +177,29 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { setupCase(headMap, null, idxMap); go(); - assertTrue(readTree.removed.contains("foo")); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.conflicts.isEmpty()); + assertTrue(theReadTree.removed.contains("foo")); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.conflicts.isEmpty()); // rule 11 setupCase(headMap, null, idxMap); new File(trash, "foo").delete(); writeTrashFile("foo", "bar"); - index.getMembers()[0].forceRecheck(); + theIndex.getMembers()[0].forceRecheck(); go(); - assertTrue(readTree.removed.isEmpty()); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.conflicts.contains("foo")); + assertTrue(theReadTree.removed.isEmpty()); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.conflicts.contains("foo")); // rule 12 & 13 headMap.put("foo", "head"); setupCase(headMap, null, idxMap); go(); - assertTrue(readTree.removed.isEmpty()); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.conflicts.contains("foo")); + assertTrue(theReadTree.removed.isEmpty()); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.conflicts.contains("foo")); // rules 14 & 15 setupCase(headMap, headMap, idxMap); @@ -209,7 +209,7 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { // rules 16 & 17 setupCase(headMap, mergeMap, idxMap); go(); - assertTrue(readTree.conflicts.contains("foo")); + assertTrue(theReadTree.conflicts.contains("foo")); // rules 18 & 19 setupCase(headMap, idxMap, idxMap); go(); @@ -217,51 +217,51 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { // rule 20 setupCase(idxMap, mergeMap, idxMap); go(); - assertTrue(readTree.updated.containsKey("foo")); + assertTrue(theReadTree.updated.containsKey("foo")); // rules 21 setupCase(idxMap, mergeMap, idxMap); new File(trash, "foo").delete(); writeTrashFile("foo", "bar"); - index.getMembers()[0].forceRecheck(); + theIndex.getMembers()[0].forceRecheck(); go(); - assertTrue(readTree.conflicts.contains("foo")); + assertTrue(theReadTree.conflicts.contains("foo")); } private void assertAllEmpty() { - assertTrue(readTree.removed.isEmpty()); - assertTrue(readTree.updated.isEmpty()); - assertTrue(readTree.conflicts.isEmpty()); + assertTrue(theReadTree.removed.isEmpty()); + assertTrue(theReadTree.updated.isEmpty()); + assertTrue(theReadTree.conflicts.isEmpty()); } public void testDirectoryFileSimple() throws IOException { - index = new GitIndex(db); - index.add(trash, writeTrashFile("DF", "DF")); - Tree treeDF = db.mapTree(index.writeTree()); + theIndex = new GitIndex(db); + theIndex.add(trash, writeTrashFile("DF", "DF")); + Tree treeDF = db.mapTree(theIndex.writeTree()); recursiveDelete(new File(trash, "DF")); - index = new GitIndex(db); - index.add(trash, writeTrashFile("DF/DF", "DF/DF")); - Tree treeDFDF = db.mapTree(index.writeTree()); + theIndex = new GitIndex(db); + theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF")); + Tree treeDFDF = db.mapTree(theIndex.writeTree()); - index = new GitIndex(db); + theIndex = new GitIndex(db); recursiveDelete(new File(trash, "DF")); - index.add(trash, writeTrashFile("DF", "DF")); - readTree = new WorkDirCheckout(db, trash, treeDF, index, treeDFDF); - readTree.prescanTwoTrees(); + theIndex.add(trash, writeTrashFile("DF", "DF")); + theReadTree = new WorkDirCheckout(db, trash, treeDF, theIndex, treeDFDF); + theReadTree.prescanTwoTrees(); - assertTrue(readTree.removed.contains("DF")); - assertTrue(readTree.updated.containsKey("DF/DF")); + assertTrue(theReadTree.removed.contains("DF")); + assertTrue(theReadTree.updated.containsKey("DF/DF")); recursiveDelete(new File(trash, "DF")); - index = new GitIndex(db); - index.add(trash, writeTrashFile("DF/DF", "DF/DF")); + theIndex = new GitIndex(db); + theIndex.add(trash, writeTrashFile("DF/DF", "DF/DF")); - readTree = new WorkDirCheckout(db, trash, treeDFDF, index, treeDF); - readTree.prescanTwoTrees(); - assertTrue(readTree.removed.contains("DF/DF")); - assertTrue(readTree.updated.containsKey("DF")); + theReadTree = new WorkDirCheckout(db, trash, treeDFDF, theIndex, treeDF); + theReadTree.prescanTwoTrees(); + assertTrue(theReadTree.removed.contains("DF/DF")); + assertTrue(theReadTree.updated.containsKey("DF")); } /* @@ -467,19 +467,19 @@ private void cleanUpDF() throws Exception { } private void assertConflict(String s) { - assertTrue(readTree.conflicts.contains(s)); + assertTrue(theReadTree.conflicts.contains(s)); } private void assertUpdated(String s) { - assertTrue(readTree.updated.containsKey(s)); + assertTrue(theReadTree.updated.containsKey(s)); } private void assertRemoved(String s) { - assertTrue(readTree.removed.contains(s)); + assertTrue(theReadTree.removed.contains(s)); } private void assertNoConflicts() { - assertTrue(readTree.conflicts.isEmpty()); + assertTrue(theReadTree.conflicts.isEmpty()); } private void doit(HashMap<String, String> h, HashMap<String, String>m, @@ -545,8 +545,8 @@ public void testCloseNameConflicts1() throws IOException { } private void checkout() throws IOException { - readTree = new WorkDirCheckout(db, trash, head, index, merge); - readTree.checkout(); + theReadTree = new WorkDirCheckout(db, trash, theHead, theIndex, theMerge); + theReadTree.checkout(); } public void testCheckoutOutChanges() throws IOException { -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 06/10] Rename the gitDir fields to indicate they refer to another dir than the default 2009-03-16 20:14 ` [EGIT PATCH 05/10] Rename fields to avoid hiding of field names in ReadTreeTest Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 07/10] Rename a parameter in PushProcessTest that hides another Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../src/org/spearce/jgit/pgm/ReceivePack.java | 10 +++++----- .../src/org/spearce/jgit/pgm/UploadPack.java | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/ReceivePack.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/ReceivePack.java index 579f893..7c72e2c 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/ReceivePack.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/ReceivePack.java @@ -45,7 +45,7 @@ @Command(common = false, usage = "Server side backend for 'jgit push'") class ReceivePack extends TextBuiltin { @Argument(index = 0, required = true, metaVar = "DIRECTORY", usage = "Repository to receive into") - File gitdir; + File newGitdir; @Override protected final boolean requiresRepository() { @@ -56,11 +56,11 @@ protected final boolean requiresRepository() { protected void run() throws Exception { final org.spearce.jgit.transport.ReceivePack rp; - if (new File(gitdir, ".git").isDirectory()) - gitdir = new File(gitdir, ".git"); - db = new Repository(gitdir); + if (new File(newGitdir, ".git").isDirectory()) + newGitdir = new File(newGitdir, ".git"); + db = new Repository(newGitdir); if (!db.getObjectsDirectory().isDirectory()) - throw die("'" + gitdir.getPath() + "' not a git repository"); + throw die("'" + newGitdir.getPath() + "' not a git repository"); rp = new org.spearce.jgit.transport.ReceivePack(db); rp.receive(System.in, System.out, System.err); } diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/UploadPack.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/UploadPack.java index d6f6d7c..b9e25d0 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/UploadPack.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/UploadPack.java @@ -45,7 +45,7 @@ @Command(common = false, usage = "Server side backend for 'jgit fetch'") class UploadPack extends TextBuiltin { @Argument(index = 0, required = true, metaVar = "DIRECTORY", usage = "Repository to read from") - File gitdir; + File newGitdir; @Override protected final boolean requiresRepository() { @@ -56,11 +56,11 @@ protected final boolean requiresRepository() { protected void run() throws Exception { final org.spearce.jgit.transport.UploadPack rp; - if (new File(gitdir, ".git").isDirectory()) - gitdir = new File(gitdir, ".git"); - db = new Repository(gitdir); + if (new File(newGitdir, ".git").isDirectory()) + newGitdir = new File(newGitdir, ".git"); + db = new Repository(newGitdir); if (!db.getObjectsDirectory().isDirectory()) - throw die("'" + gitdir.getPath() + "' not a git repository"); + throw die("'" + newGitdir.getPath() + "' not a git repository"); rp = new org.spearce.jgit.transport.UploadPack(db); rp.upload(System.in, System.out, System.err); } -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 07/10] Rename a parameter in PushProcessTest that hides another 2009-03-16 20:14 ` [EGIT PATCH 06/10] Rename the gitDir fields to indicate they refer to another dir than the default Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Robin Rosenberg 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../spearce/jgit/transport/PushProcessTest.java | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/PushProcessTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/PushProcessTest.java index eafd89c..ef9a8c8 100644 --- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/PushProcessTest.java +++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/PushProcessTest.java @@ -401,9 +401,9 @@ public void close() { } public void push(ProgressMonitor monitor, - Map<String, RemoteRefUpdate> refUpdates) + Map<String, RemoteRefUpdate> refsToUpdate) throws TransportException { - for (final RemoteRefUpdate rru : refUpdates.values()) { + for (final RemoteRefUpdate rru : refsToUpdate.values()) { assertEquals(Status.NOT_ATTEMPTED, rru.getStatus()); rru.setStatus(connectionUpdateStatus); } -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code 2009-03-16 20:14 ` [EGIT PATCH 07/10] Rename a parameter in PushProcessTest that hides another Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout Robin Rosenberg 2009-03-16 20:39 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Shawn O. Pearce 0 siblings, 2 replies; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg Is this safe, or should they actually be used? --- .../org/spearce/jgit/patch/CombinedHunkHeader.java | 2 +- .../src/org/spearce/jgit/patch/HunkHeader.java | 2 +- .../src/org/spearce/jgit/patch/Patch.java | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/CombinedHunkHeader.java b/org.spearce.jgit/src/org/spearce/jgit/patch/CombinedHunkHeader.java index 83ea681..b1aef91 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/CombinedHunkHeader.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/CombinedHunkHeader.java @@ -90,7 +90,7 @@ public OldImage getOldImage(final int nthParent) { } @Override - void parseHeader(final int end) { + void parseHeader() { // Parse "@@@ -55,12 -163,13 +163,15 @@@ protected boolean" // final byte[] buf = file.buf; diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java index e3ce546..e9c55e3 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/HunkHeader.java @@ -161,7 +161,7 @@ public int getLinesContext() { return nContext; } - void parseHeader(final int end) { + void parseHeader() { // Parse "@@ -236,9 +236,9 @@ protected boolean" // final byte[] buf = file.buf; diff --git a/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java b/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java index 9c2a8d6..4b2121e 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java +++ b/org.spearce.jgit/src/org/spearce/jgit/patch/Patch.java @@ -222,7 +222,7 @@ private int parseDiffGit(final byte[] buf, final int start, final int end) { final FileHeader fh = new FileHeader(buf, start); int ptr = fh.parseGitFileName(start + DIFF_GIT.length, end); if (ptr < 0) - return skipFile(buf, start, end); + return skipFile(buf, start); ptr = fh.parseGitHeaders(ptr, end); ptr = parseHunks(fh, ptr, end); @@ -236,7 +236,7 @@ private int parseDiffCombined(final byte[] hdr, final byte[] buf, final CombinedFileHeader fh = new CombinedFileHeader(buf, start); int ptr = fh.parseGitFileName(start + hdr.length, end); if (ptr < 0) - return skipFile(buf, start, end); + return skipFile(buf, start); ptr = fh.parseGitHeaders(ptr, end); ptr = parseHunks(fh, ptr, end); @@ -255,7 +255,7 @@ private int parseTraditionalPatch(final byte[] buf, final int start, return ptr; } - private static int skipFile(final byte[] buf, int ptr, final int end) { + private static int skipFile(final byte[] buf, int ptr) { ptr = nextLF(buf, ptr); if (match(buf, ptr, OLD_NAME) >= 0) ptr = nextLF(buf, ptr); @@ -282,7 +282,7 @@ private int parseHunks(final FileHeader fh, int c, final int end) { if (isHunkHdr(buf, c, end) == fh.getParentCount()) { final HunkHeader h = fh.newHunkHeader(c); - h.parseHeader(end); + h.parseHeader(); c = h.parseBody(this, end); h.endOffset = c; fh.addHunk(h); -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout 2009-03-16 20:14 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 10/10] Drop an effectively unused parameter in IndexTreeWalker Robin Rosenberg 2009-03-16 20:39 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Shawn O. Pearce 1 sibling, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg --- .../src/org/spearce/jgit/lib/IndexTreeWalker.java | 8 ++++---- .../src/org/spearce/jgit/lib/WorkDirCheckout.java | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java index 5c7909a..e2078e1 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java @@ -104,10 +104,10 @@ public IndexTreeWalker(GitIndex index, Tree mainTree, Tree newTree, File root, I * @throws IOException */ public void walk() throws IOException { - walk(mainTree, newTree, ""); + walk(mainTree, newTree); } - private void walk(Tree tree, Tree auxTree, String curDir) throws IOException { + private void walk(Tree tree, Tree auxTree) throws IOException { TreeIterator mi = new TreeIterator(tree, TreeIterator.Order.POSTORDER); TreeIterator ai = new TreeIterator(auxTree, TreeIterator.Order.POSTORDER); TreeEntry m = mi.hasNext() ? mi.next() : null; @@ -124,7 +124,7 @@ private void walk(Tree tree, Tree auxTree, String curDir) throws IOException { Entry pi = cmpmi >= 0 && cmpai >= 0 ? i : null; if (pi != null) - visitEntry(pm, pa, pi, root); + visitEntry(pm, pa, pi); else finishVisitTree(pm, pa, curIndexPos, root); @@ -135,7 +135,7 @@ private void walk(Tree tree, Tree auxTree, String curDir) throws IOException { } private void visitEntry(TreeEntry t1, TreeEntry t2, - Entry i, File root) throws IOException { + Entry i) throws IOException { assert t1 != null || t2 != null || i != null : "Needs at least one entry"; assert root != null : "Needs workdir"; diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java b/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java index d3da74a..8435223 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/WorkDirCheckout.java @@ -259,7 +259,7 @@ public void visitEntry(TreeEntry treeEntry, TreeEntry auxEntry, if (treeEntry instanceof Tree || auxEntry instanceof Tree) { throw new IllegalArgumentException("Can't pass me a tree!"); } - processEntry(treeEntry, auxEntry, indexEntry, file); + processEntry(treeEntry, auxEntry, indexEntry); } @Override @@ -294,8 +294,7 @@ else if (file.isDirectory()) { conflicts.removeAll(removed); } - void processEntry(TreeEntry h, TreeEntry m, Entry i, - File file) throws IOException { + void processEntry(TreeEntry h, TreeEntry m, Entry i) throws IOException { ObjectId iId = (i == null ? null : i.getObjectId()); ObjectId mId = (m == null ? null : m.getId()); ObjectId hId = (h == null ? null : h.getId()); -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [EGIT PATCH 10/10] Drop an effectively unused parameter in IndexTreeWalker. 2009-03-16 20:14 ` [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout Robin Rosenberg @ 2009-03-16 20:14 ` Robin Rosenberg 0 siblings, 0 replies; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw) To: spearce; +Cc: git, Robin Rosenberg The value was always the same as the field it shadowed --- .../src/org/spearce/jgit/lib/IndexTreeWalker.java | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java index e2078e1..0f1aef4 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/IndexTreeWalker.java @@ -126,7 +126,7 @@ private void walk(Tree tree, Tree auxTree) throws IOException { if (pi != null) visitEntry(pm, pa, pi); else - finishVisitTree(pm, pa, curIndexPos, root); + finishVisitTree(pm, pa, curIndexPos); if (pm != null) m = mi.hasNext() ? mi.next() : null; if (pa != null) a = ai.hasNext() ? ai.next() : null; @@ -160,7 +160,7 @@ else if (t2 != null) visitor.visitEntry(t1, i, f); } - private void finishVisitTree(TreeEntry t1, TreeEntry t2, int curIndexPos, File root) + private void finishVisitTree(TreeEntry t1, TreeEntry t2, int curIndexPos) throws IOException { assert t1 != null || t2 != null : "Needs at least one entry"; -- 1.6.1.285.g35d8b ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code 2009-03-16 20:14 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout Robin Rosenberg @ 2009-03-16 20:39 ` Shawn O. Pearce 1 sibling, 0 replies; 15+ messages in thread From: Shawn O. Pearce @ 2009-03-16 20:39 UTC (permalink / raw) To: Robin Rosenberg; +Cc: spearce, git Robin Rosenberg <robin.rosenberg@dewire.com> wrote: > Is this safe, or should they actually be used? Yea, these are safe to remove. At worst we move one line beyond the end marker given to us by the user in Patch.parse() and then abort the parse loop when we find ptr >= end. We should also never exceed the byte[] length; the ParseUtils methods we use do their own array bound checks internally. > .../org/spearce/jgit/patch/CombinedHunkHeader.java | 2 +- > .../src/org/spearce/jgit/patch/HunkHeader.java | 2 +- > .../src/org/spearce/jgit/patch/Patch.java | 8 ++++---- > 3 files changed, 6 insertions(+), 6 deletions(-) -- Shawn. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to 2009-03-16 20:14 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess Robin Rosenberg @ 2009-03-16 20:25 ` Shawn O. Pearce 2009-03-16 21:25 ` Robin Rosenberg 1 sibling, 1 reply; 15+ messages in thread From: Shawn O. Pearce @ 2009-03-16 20:25 UTC (permalink / raw) To: Robin Rosenberg; +Cc: spearce, git Robin Rosenberg <robin.rosenberg@dewire.com> wrote: > It is used for looking at alternate objects, so name it such No SOB? But I disagree with this name change. Its pointing at the objects directory of a repository. It may also be used to point at an alternate when opening an alternate, in which case it points at the alternate's objects directory. IMHO, objectsUrl is the right name for this. > --- > .../org/spearce/jgit/transport/TransportHttp.java | 14 +++++++------- > 1 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java > index fe4a437..38d26b3 100644 > --- a/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java > +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/TransportHttp.java > @@ -112,15 +112,15 @@ public void close() { > } > > class HttpObjectDB extends WalkRemoteObjectDatabase { > - private final URL objectsUrl; > + private final URL alternateObjectsUrl; -- Shawn. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to 2009-03-16 20:25 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Shawn O. Pearce @ 2009-03-16 21:25 ` Robin Rosenberg 2009-03-16 21:28 ` Shawn O. Pearce 0 siblings, 1 reply; 15+ messages in thread From: Robin Rosenberg @ 2009-03-16 21:25 UTC (permalink / raw) To: Shawn O. Pearce; +Cc: spearce, git måndag 16 mars 2009 21:25:13 skrev "Shawn O. Pearce" <spearce@spearce.org>: > Robin Rosenberg <robin.rosenberg@dewire.com> wrote: > > It is used for looking at alternate objects, so name it such > > No SOB? > > But I disagree with this name change. Its pointing at the > objects directory of a repository. It may also be used to > point at an alternate when opening an alternate, in which > case it points at the alternate's objects directory. > > IMHO, objectsUrl is the right name for this. Ok, I missed the real reason in the comment. It is name hiding. objectsUrl is the name of another variable in the outer scope. -- robin ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to 2009-03-16 21:25 ` Robin Rosenberg @ 2009-03-16 21:28 ` Shawn O. Pearce 0 siblings, 0 replies; 15+ messages in thread From: Shawn O. Pearce @ 2009-03-16 21:28 UTC (permalink / raw) To: Robin Rosenberg; +Cc: spearce, git Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote: > måndag 16 mars 2009 21:25:13 skrev "Shawn O. Pearce" <spearce@spearce.org>: > > Robin Rosenberg <robin.rosenberg@dewire.com> wrote: > > > It is used for looking at alternate objects, so name it such > > > > No SOB? > > > > But I disagree with this name change. Its pointing at the > > objects directory of a repository. It may also be used to > > point at an alternate when opening an alternate, in which > > case it points at the alternate's objects directory. > > > > IMHO, objectsUrl is the right name for this. > > Ok, I missed the real reason in the comment. It is name hiding. objectsUrl > is the name of another variable in the outer scope. OK. I still disagree with the name change. Can we hide the outer name by making it private? Or come up with a better name for the inner one? -- Shawn. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2009-03-16 21:30 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-03-16 20:14 [EGIT PATCH 00/10] JGit cleanups Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 01/10] Require javadoc on protected methods in jgit core Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 04/10] Rename a parameter i PackWriter that hides another with the same name Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 05/10] Rename fields to avoid hiding of field names in ReadTreeTest Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 06/10] Rename the gitDir fields to indicate they refer to another dir than the default Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 07/10] Rename a parameter in PushProcessTest that hides another Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout Robin Rosenberg 2009-03-16 20:14 ` [EGIT PATCH 10/10] Drop an effectively unused parameter in IndexTreeWalker Robin Rosenberg 2009-03-16 20:39 ` [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code Shawn O. Pearce 2009-03-16 20:25 ` [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to Shawn O. Pearce 2009-03-16 21:25 ` Robin Rosenberg 2009-03-16 21:28 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).