Git development
 help / color / mirror / Atom feed
* Re: [JGIT PATCH] Create a debugging tool "jgit rebuild-commitgraph"
From: Robin Rosenberg @ 2009-03-16 20:09 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20090316144450.GN22920@spearce.org>

måndag 16 mars 2009 15:44:50 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> > 
> > I'd hate to put such a dangerous thing in the list of normal tools. If the user
> > want to shoot him/her-self in the foot they should get a license first.
> 
> How about squashing this in?

Does it have to be a utility accessible through the pgm interface? Why not 
just run ut as java org.spearce.jgit.pgm.debug.RebuildCommitGraph ? 

> 
> diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/RebuildCommitGraph.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/RebuildCommitGraph.java
> index ccee997..cc23438 100644
> --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/RebuildCommitGraph.java
> +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/RebuildCommitGraph.java
> @@ -50,6 +50,7 @@
>  import java.util.Map;
>  
>  import org.kohsuke.args4j.Argument;
> +import org.kohsuke.args4j.Option;
>  import org.spearce.jgit.errors.MissingObjectException;
>  import org.spearce.jgit.errors.ObjectWritingException;
>  import org.spearce.jgit.lib.Commit;
> @@ -85,6 +86,11 @@
>   * <p>
>   */
>  class RebuildCommitGraph extends TextBuiltin {
> +	private final String REALLY = "--destroy-this-repository";
> +
> +	@Option(name = REALLY, usage = "approve destruction of repository")
> +	boolean really;
> +
>  	@Argument(index = 0, required = true, metaVar = "REFS", usage = "for-each-ref output")
>  	File refList;
>  
> @@ -97,6 +103,30 @@
>  
>  	@Override
>  	protected void run() throws Exception {
> +		if (!really && !db.getAllRefs().isEmpty()) {
> +			final StringBuilder m = new StringBuilder();
> +			m.append("fatal: ");
> +			m.append("This program will destroy the repository:");
> +			m.append("\n");
> +			m.append("fatal:\n");
> +			m.append("fatal:    ");
> +			m.append(db.getDirectory().getAbsolutePath());
> +			m.append("\n");
> +			m.append("fatal:\n");
> +			m.append("fatal: ");
> +			m.append("To continue, add ");
> +			m.append(REALLY);
> +			m.append(" to the command line");
> +			m.append("\n");
> +			m.append("fatal:");
> +			System.err.println(m);
> +			throw die("Need approval to destroy current repository");

What's wrong with old fashioned '+' ? (which just translated to exactly this series
of StringBuilder calls anyway?

> +		}
> +		if (!refList.isFile())
> +			throw die("no such file: " + refList.getPath());
> +		if (!graph.isFile())
> +			throw die("no such file: " + graph.getPath());
> +
>  		recreateCommitGraph();
>  		detachHead();
>  		deleteAllRefs();

-- robin

^ permalink raw reply

* Re: undoing something
From: Junio C Hamano @ 2009-03-16 20:11 UTC (permalink / raw)
  To: John Dlugosz; +Cc: git
In-Reply-To: <450196A1AAAE4B42A00A8B27A59278E70A2AEFD7@EXCHANGE.trad.tradestation.com>

"John Dlugosz" <JDlugosz@TradeStation.com> writes:

> === Re: ===
> The answer was best only because in your previous question you wanted to
> ensure fast-forwardness, i.e. "git push . origin/dev:dev" without plus
> in
> front to cause it to fail if it is not fast-forward.
> === end ===

This is offtopic, but *PLEASE* notice that nobody else quotes like this
around here.  I find the style of quoting makes it unnecessarily harder to
skip over parts that others wrote (and I've already read---so I do not
want to waste my time on re-reading them) to get to what you are adding to
the discussion quickly, and extremely annoying.  It is the reason why I am
skipping many of your replies to other people without reading to the end,
even when I suspect you might be saying something worth reading.

> No, I don't want to ensure ff.

I was referring to the exchange that started with this message from you:

From: "John Dlugosz" <JDlugosz@TradeStation.com>
Date: Fri, 6 Mar 2009 14:04:25 -0500
Message-ID: <450196A1AAAE4B42A00A8B27A59278E70A115E0D@EXCHANGE.trad.tradestation.com>

where you asked:

> I want to advocate running
> 
>         git fetch
> 
> as being a safe thing to do at any time, just to refresh your view of
> the origin and not mess up any of your local labels.  That is, you can
> see the difference between the local dev and the origin/dev.
> 
> So, after inspecting the changes, how do you fast-forward your local dev
> to sync up with origin/dev?

and I gave you an answer (with a typo you corrected in another message
today) "git push . origin/dev:dev".  In that context, you clearly want to
encure fast-forward, and local push without + is an easy and safe way to
do so.

That is where "it is best only because" came from.  If you are not
interested in ensuring fast-forward, "local push" may not be best, and
there are other ways (I've shown you at least two, so I won't repeat
them) to choose from.

^ permalink raw reply

* Re: [JGIT PATCH] Create a debugging tool "jgit rebuild-commitgraph"
From: Shawn O. Pearce @ 2009-03-16 20:13 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git
In-Reply-To: <200903162109.46653.robin.rosenberg.lists@dewire.com>

Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> måndag 16 mars 2009 15:44:50 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> > Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> > > 
> > > I'd hate to put such a dangerous thing in the list of normal tools. If the user
> > > want to shoot him/her-self in the foot they should get a license first.
> > 
> > How about squashing this in?
> 
> Does it have to be a utility accessible through the pgm interface? Why not 
> just run ut as java org.spearce.jgit.pgm.debug.RebuildCommitGraph ? 

Yea, that's fine too.  Then its "debug-rebuildcommitgraph" I think,
but that's still a reasonable name for it.
 
> >  	@Override
> >  	protected void run() throws Exception {
> > +		if (!really && !db.getAllRefs().isEmpty()) {
> > +			final StringBuilder m = new StringBuilder();
> > +			m.append("fatal: ");
...
> > +			System.err.println(m);
> > +			throw die("Need approval to destroy current repository");
> 
> What's wrong with old fashioned '+' ? (which just translated to exactly this series
> of StringBuilder calls anyway?

Nothing, other than formatting.  + line wraps somewhat ugly sometimes
under the Eclipse formatter.  Using StringBuilder with one append per
line and a short name for the StringBuilder variable makes it easier
to format.

-- 
Shawn.

^ permalink raw reply

* [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-2-git-send-email-robin.rosenberg@dewire.com>

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

* [EGIT PATCH 00/10] JGit cleanups
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

* [EGIT PATCH 03/10] Rename variables that hides others with different content in FetchProcess
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-3-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 01/10] Require javadoc on protected methods in jgit core
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-1-git-send-email-robin.rosenberg@dewire.com>

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

* [EGIT PATCH 04/10] Rename a parameter i PackWriter that hides another with the same name
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-4-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 06/10] Rename the gitDir fields to indicate they refer to another dir than the default
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-6-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 05/10] Rename fields to avoid hiding of field names in ReadTreeTest
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-5-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 07/10] Rename a parameter in PushProcessTest that hides another
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-7-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 10/10] Drop an effectively unused parameter in IndexTreeWalker.
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-10-git-send-email-robin.rosenberg@dewire.com>

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

* [EGIT PATCH 09/10] Drop unused File arguments in IndexTreeWalker and WorkdirCheckout
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-9-git-send-email-robin.rosenberg@dewire.com>

---
 .../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

* [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code
From: Robin Rosenberg @ 2009-03-16 20:14 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1237234483-3405-8-git-send-email-robin.rosenberg@dewire.com>

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

* [PATCH] Tests: use test_cmp instead of diff where possible
From: Miklos Vajna @ 2009-03-16 20:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ren� Scharfe, git
In-Reply-To: <49BD4C28.4030303@lsrfire.ath.cx>

Several old tests were written before test_cmp was introduced, convert
these to test_cmp.

If were are at it, fix the order of the arguments where necessary to
make expected come first, so the command shows how the test result
deviates from the correct output.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

On Sun, Mar 15, 2009 at 07:42:48PM +0100, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:
> >  t/t5000-tar-tree.sh                 |    2 +-
> >  t/t9001-send-email.sh               |    2 +-
> >  7 files changed, 14 insertions(+), 14 deletions(-)
>
> You _did_ touch t5000, and converted one of the diff calls.  I agree
> that the ones using the option -r should stay, but the rest could be
> switched to test_cmp, too.

OK, changed all occurrences, where no options were used.

I also fixed the order problems.

 t/t0000-basic.sh                    |    8 ++++----
 t/t1100-commit-tree-options.sh      |    2 +-
 t/t1400-update-ref.sh               |    6 +++---
 t/t3000-ls-files-others.sh          |    4 ++--
 t/t3010-ls-files-killed-modified.sh |    4 ++--
 t/t5000-tar-tree.sh                 |   22 +++++++++++-----------
 t/t9001-send-email.sh               |    2 +-
 7 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 70df15c..ddcd5b0 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -127,7 +127,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'validate git ls-files output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 test_expect_success \
     'writing tree out with git write-tree.' \
@@ -147,7 +147,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 # This changed in ls-tree pathspec change -- recursive does
 # not show tree nodes anymore.
@@ -166,7 +166,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 # But with -r -t we can have both.
 test_expect_success \
@@ -187,7 +187,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'git ls-tree -r output for a known tree.' \
-    'diff current expected'
+    'test_cmp expected current'
 
 test_expect_success \
     'writing partial tree out with git write-tree --prefix.' \
diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh
index 7f7fc36..c4414ff 100755
--- a/t/t1100-commit-tree-options.sh
+++ b/t/t1100-commit-tree-options.sh
@@ -40,6 +40,6 @@ test_expect_success \
 
 test_expect_success \
     'compare commit' \
-    'diff expected commit'
+    'test_cmp expected commit'
 
 test_done
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index bd58926..54ba3df 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -137,7 +137,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 rm -rf .git/$m .git/logs expect
 
 test_expect_success \
@@ -168,7 +168,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000
 EOF
 test_expect_success \
 	"verifying $m's log" \
-	'diff expect .git/logs/$m'
+	'test_cmp expect .git/logs/$m'
 rm -f .git/$m .git/logs/$m expect
 
 git update-ref $m $D
@@ -272,7 +272,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000	c
 EOF
 test_expect_success \
 	'git commit logged updates' \
-	"diff expect .git/logs/$m"
+	"test_cmp expect .git/logs/$m"
 unset h_TEST h_OTHER h_FIXED h_MERGED
 
 test_expect_success \
diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh
index bc0a351..36eee0f 100755
--- a/t/t3000-ls-files-others.sh
+++ b/t/t3000-ls-files-others.sh
@@ -42,7 +42,7 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others should pick up symlinks.' \
-    'diff output expected1'
+    'test_cmp expected1 output'
 
 test_expect_success \
     'git ls-files --others --directory to show output.' \
@@ -51,6 +51,6 @@ test_expect_success \
 
 test_expect_success \
     'git ls-files --others --directory should not get confused.' \
-    'diff output expected2'
+    'test_cmp expected2 output'
 
 test_done
diff --git a/t/t3010-ls-files-killed-modified.sh b/t/t3010-ls-files-killed-modified.sh
index ec14040..e4f02a0 100755
--- a/t/t3010-ls-files-killed-modified.sh
+++ b/t/t3010-ls-files-killed-modified.sh
@@ -75,7 +75,7 @@ EOF
 
 test_expect_success \
     'validate git ls-files -k output.' \
-    'diff .output .expected'
+    'test_cmp .expected .output'
 
 test_expect_success \
     'git ls-files -m to show modified files.' \
@@ -91,6 +91,6 @@ EOF
 
 test_expect_success \
     'validate git ls-files -m output.' \
-    'diff .output .expected'
+    'test_cmp .expected .output'
 
 test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index b7e3628..e1ed073 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -76,7 +76,7 @@ test_expect_success \
 
 test_expect_success \
     'git archive vs. git tar-tree' \
-    'diff b.tar b2.tar'
+    'test_cmp b.tar b2.tar'
 
 test_expect_success \
     'git archive in a bare repo' \
@@ -96,12 +96,12 @@ test_expect_success \
      "$TAR" xf b.tar -C extract a/a &&
      test-chmtime -v +0 extract/a/a |cut -f 1 >b.mtime &&
      echo "1117231200" >expected.mtime &&
-     diff expected.mtime b.mtime'
+     test_cmp expected.mtime b.mtime'
 
 test_expect_success \
     'git get-tar-commit-id' \
     'git get-tar-commit-id <b.tar >b.commitid &&
-     diff .git/$(git symbolic-ref HEAD) b.commitid'
+     test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
 
 test_expect_success \
     'extract tar archive' \
@@ -110,7 +110,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames' \
     '(cd b/a && find .) | sort >b.lst &&
-     diff a.lst b.lst'
+     test_cmp a.lst b.lst'
 
 test_expect_success \
     'validate file contents' \
@@ -127,7 +127,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames with prefix' \
     '(cd c/prefix/a && find .) | sort >c.lst &&
-     diff a.lst c.lst'
+     test_cmp a.lst c.lst'
 
 test_expect_success \
     'validate file contents with prefix' \
@@ -148,8 +148,8 @@ test_expect_success \
      'validate substfile contents' \
      'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
       >f/a/substfile1.expected &&
-      diff f/a/substfile1.expected f/a/substfile1 &&
-      diff a/substfile2 f/a/substfile2
+      test_cmp f/a/substfile1.expected f/a/substfile1 &&
+      test_cmp a/substfile2 f/a/substfile2
 '
 
 test_expect_success \
@@ -160,8 +160,8 @@ test_expect_success \
      'validate substfile contents from archive with prefix' \
      'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
       >g/prefix/a/substfile1.expected &&
-      diff g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
-      diff a/substfile2 g/prefix/a/substfile2
+      test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
+      test_cmp a/substfile2 g/prefix/a/substfile2
 '
 
 test_expect_success \
@@ -194,7 +194,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames' \
     '(cd d/a && find .) | sort >d.lst &&
-     diff a.lst d.lst'
+     test_cmp a.lst d.lst'
 
 test_expect_success \
     'validate file contents' \
@@ -211,7 +211,7 @@ test_expect_success \
 test_expect_success \
     'validate filenames with prefix' \
     '(cd e/prefix/a && find .) | sort >e.lst &&
-     diff a.lst e.lst'
+     test_cmp a.lst e.lst'
 
 test_expect_success \
     'validate file contents with prefix' \
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 08d5b91..9523305 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -88,7 +88,7 @@ cat >expected <<\EOF
 EOF
 test_expect_success \
     'Verify commandline' \
-    'diff commandline1 expected'
+    'test_cmp expected commandline1'
 
 cat >expected-show-all-headers <<\EOF
 0001-Second.patch
-- 
1.6.2

^ permalink raw reply related

* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to
From: Shawn O. Pearce @ 2009-03-16 20:25 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: spearce, git
In-Reply-To: <1237234483-3405-3-git-send-email-robin.rosenberg@dewire.com>

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

* Re: [EGIT PATCH 08/10] Drop unused end parameters in hunk parsing code
From: Shawn O. Pearce @ 2009-03-16 20:39 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: spearce, git
In-Reply-To: <1237234483-3405-9-git-send-email-robin.rosenberg@dewire.com>

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

* RE: fetch and pull
From: John Dlugosz @ 2009-03-16 20:39 UTC (permalink / raw)
  To: Jay Soffian; +Cc: git, Junio C Hamano
In-Reply-To: <76718490903161303h45e47a8co83159e32ae749352@mail.gmail.com>

=== Re: ===
You very likely do not want the '+' at the start:

$ git push . origin/dev:dev

j.

=== end ===

Yes, I do.  If the central repository changed dev in some way other than a fast-forward, or if you really messed up your local dev, it still needs to be repointed.

Remember the overall flow:  first fetch (not pull) and then inspect the difference between your dev and origin/dev.  Then, change your dev to match.

--John

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply

* Re: fetch and pull
From: Sverre Rabbelier @ 2009-03-16 20:43 UTC (permalink / raw)
  To: John Dlugosz; +Cc: Jay Soffian, git, Junio C Hamano
In-Reply-To: <450196A1AAAE4B42A00A8B27A59278E70A2AF023@EXCHANGE.trad.tradestation.com>

Heya,

On Mon, Mar 16, 2009 at 21:39, John Dlugosz <JDlugosz@tradestation.com> wrote:
> PT09IFJlOiA9PT0NCllvdSB2ZXJ5IGxpa2VseSBkbyBub3Qgd2FudCB0aGUg

Forgot to turn off encryption?

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* git-svn rebase can change branches during merge?
From: Kevin Williams @ 2009-03-16 20:49 UTC (permalink / raw)
  To: git

I've outlined steps where I can reproduce this bug here:
http://gist.github.com/80058

When using "git svn rebase" and there is a conflict between a local
(git) change and an upstream (svn) change, the local git repository is
left in a ghost-branch. It shouldn't change branches during a rebase,
should it? I also seem to be unable to recover from the merge
conflict, but that may be just due to the noob at the keyboard (me).

I tried working through this with some folks in the #git channel last
week but they were stumped as well.

I'm using the latest Git build from MacPorts (1.6.2.1 as of today) on
a MacbookPro with OS X 10.5.6 (fully updated with all patches)

-- 
Cheers,

Kevin Williams

^ permalink raw reply

* Effective Posting
From: John Dlugosz @ 2009-03-16 20:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3addw7mv.fsf@gitster.siamese.dyndns.org>

If you can tell me how to make Outlook insert >'s in front of a block of
text, I'm all ears.  I can't find any kind of "quote content" or "paste
as quotation" on the menus, or any option to do anything with the
original message other than to put it at the end with ---original
message--- in front of it.  This was the best I could figure out that
was useful, and gets replies threaded (mostly) properly.  While you're
at it, how do you tell Outlook to always start a message in "plain text"
(not HTML) based on the target address, like Thunderbird does?

Alternatively, tell me how to reply using the Gmane web viewer, or point
me to another web-based viewer that shows current content.

Or, the mailing list server could translate Outlook's visible
interspersed quotes (the original message is blue, new typing is black)
with a uniform quote style that is specified in each subscriber's
preference settings.

Could be worse.  Ever use Lotus Notes?

--John


-----Original Message-----
From: Junio C Hamano [mailto:gitster@pobox.com] 
Sent: Monday, March 16, 2009 3:11 PM
To: John Dlugosz
Cc: git@vger.kernel.org
Subject: Re: undoing something

"John Dlugosz" <JDlugosz@TradeStation.com> writes:

> === Re: ===
> The answer was best only because in your previous question you wanted
to
> ensure fast-forwardness, i.e. "git push . origin/dev:dev" without plus
> in
> front to cause it to fail if it is not fast-forward.
> === end ===

This is offtopic, but *PLEASE* notice that nobody else quotes like this
around here.  I find the style of quoting makes it unnecessarily harder
to
skip over parts that others wrote (and I've already read---so I do not
want to waste my time on re-reading them) to get to what you are adding
to
the discussion quickly, and extremely annoying.  It is the reason why I
am
skipping many of your replies to other people without reading to the
end,
even when I suspect you might be saying something worth reading.




TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
  If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply

* Re: git-svn: creating tags from a subdirectory of trunk
From: Eric Wong @ 2009-03-16 21:08 UTC (permalink / raw)
  To: Tom Huybrechts; +Cc: git
In-Reply-To: <632a37a0903161202w23848f41g5cde3942195369cb@mail.gmail.com>

Tom Huybrechts <tom.huybrechts@gmail.com> wrote:
> On Mon, Mar 16, 2009 at 12:21 AM, Eric Wong <normalperson@yhbt.net> wrote:
> > Tom Huybrechts <tom.huybrechts@gmail.com> wrote:
> >> Hi,
> >>
> >> I'm trying to setup a git mirror of a svn repository.  The tags in
> >> this repository are not created trunk it self, but from subdirectories
> >> of trunk. The tags and branches are in the standard places.
> >> e.g:
> >> /trunk/main -> tags/main-1
> >> /trunk/plugins/foo -> tags/foo-1
> >> /trunk/plugins/bar -> tags/bar-1
> >>
> >> I run 'git svn clone -s svn-url target'. It starts going over the
> >> history nicely until it reaches the first branch. It calls this branch
> >> something like tags/tag-name@revision, and starts retrieving the
> >> entire project history again from r1. This is repeated for every
> >> branch.
> >
> > Hi Tom,
> >
> > This is a known problem with some repositories.  My suggestion is to
> > use individual "fetch" directives for each of those tags you want to
> > follow.
> >
> > The -s/--stdlayout is only for projects that follow the SVN-recommended
> > repository layout exactly and we haven't thought of a generic way to
> > handle those non-standard tags in repos...
> >
> > --
> > Eric Wong
> >
> 
> Hi Eric,
> 
> The repository I'm trying to convert is that of Hudson. I did some
> digging in the list archives, and found this came up earlier
> (2009/01/08).
> Back then you replied:
> 
> """
> Alternately, you could just clone the root and have all the branches all
> over the place in one tree (your eventually working copy will be huge).
> 
>   git svn clone https://svn.dev.java.net/svn/hudson
> 
> 
> Basically this is the equivalent of:
> 
>   svn co https://svn.dev.java.net/svn/hudson
> 
> Except you'll have the full history.
> """
> 
> Is that still valid ? That is what I did, and which caused the
> behaviour I described.

I did not use the -s/--stdlayout option in my example.
But yeah, either way that repository is nasty with git-svn :<

-- 
Eric Wong

^ permalink raw reply

* Re: [PATCH v2] New config push.default to decide default behavior for push
From: Junio C Hamano @ 2009-03-16 21:13 UTC (permalink / raw)
  To: Finn Arne Gangstad; +Cc: git
In-Reply-To: <20090316155629.GA17526@pvv.org>

Finn Arne Gangstad <finnag@pvv.org> writes:

> On Sun, Mar 15, 2009 at 09:55:23PM -0700, Junio C Hamano wrote:
>> Junio C Hamano <gitster@pobox.com> writes:
>> 
>> As some people still seem to object to the change of default (and that
>> includes 20-30% of myself), we may end up deciding not to switch the
>> default after all, but even in that case, applying the first half would
>> benefit people who would want different behaviour.
>
> I think the suggested new default is a lot safer then the current
> one. A default of "nothing" will print a nice message if you end up
> pushing nothing, which you will fix in a heartbeat with a single git
> config command.
>
> If you erroneously push one or more branches however, cleanup might
> end up being very complicated. Many pushable repos are set up with
> disallowing non-fast-forward pushes, so it may require intervention by
> someone else to clean up, and by then someone else have already
> fetched the bad push.

I think traditionalists who do not like changing the default already know
these, though.  I would not object to the push.default as a _choice_.

In fact, sourceforge.jp (they added git support late last year, and I keep
a secondary public repository just like my alt-git.git at repo.or.cz) is
one of such places.  It seems to forbid non fast-forward pushes, and that
is why I have been pushing only maint and master there.  It does allow
deletion, and I could push deletion followed by creation in two stages,
i.e. "git push sfjp :pu && git push sfjp pu", but I did not bother.

In a later part of the message you are responding to (but did not quote),
I was agreeing with all of what you wrote here, and even more ;-) Notice
the "tradeoff does not look too bad to me" part.

Your new [1/2] gives the choice without advertisement, and _if_ you remove
or tone down "The default may change in the future" from [2/2], it becomes
purely an advertisement of the feature to help people from burning
themselves.  I do not see anything a sane traditionist would object to at
that point, and I thought we could even squash the two into one commit
(which was what I meant by "I am inclined to change my mind" in the
message you are responding to).

^ permalink raw reply

* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to
From: Robin Rosenberg @ 2009-03-16 21:25 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: spearce, git
In-Reply-To: <20090316202513.GS22920@spearce.org>

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

* Re: [EGIT PATCH 02/10] Rename the objectsUrl in the nested HttpObjectDB to
From: Shawn O. Pearce @ 2009-03-16 21:28 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: spearce, git
In-Reply-To: <200903162225.00347.robin.rosenberg.lists@dewire.com>

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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox