git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Allow monitor/unintersting objects to be null
@ 2009-05-06 19:57 Alex Blewitt
  2009-05-06 20:02 ` Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Blewitt @ 2009-05-06 19:57 UTC (permalink / raw)
  To: spearce, robin.rosenberg; +Cc: git, Alex Blewitt

---
 .../src/org/spearce/jgit/lib/PackWriter.java       |    5 +++--
 1 files changed, 3 insertions(+), 2 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 ea63942..3d7004d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
@@ -230,8 +230,8 @@ public class PackWriter {
 	public PackWriter(final Repository repo, final ProgressMonitor imonitor,
 			final ProgressMonitor wmonitor) {
 		this.db = repo;
-		initMonitor = imonitor;
-		writeMonitor = wmonitor;
+		initMonitor = (imonitor == null ? new NullProgressMonitor() : imonitor);
+		writeMonitor = (wmonitor == null ? new NullProgressMonitor() : wmonitor);
 		this.deflater = new Deflater(db.getConfig().getCore().getCompression());
 		outputVersion = repo.getConfig().getCore().getPackIndexVersion();
 	}
@@ -829,6 +829,7 @@ public class PackWriter {
 			RevObject o = walker.parseAny(id);
 			walker.markStart(o);
 		}
+		if (uninterestingObjects != null)
 		for (ObjectId id : uninterestingObjects) {
 			final RevObject o;
 			try {
-- 
1.6.2.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Allow monitor/unintersting objects to be null
  2009-05-06 19:57 [PATCH] Allow monitor/unintersting objects to be null Alex Blewitt
@ 2009-05-06 20:02 ` Shawn O. Pearce
  0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2009-05-06 20:02 UTC (permalink / raw)
  To: Alex Blewitt; +Cc: robin.rosenberg, git

Alex Blewitt <alex.blewitt@gmail.com> wrote:
> ---
>  .../src/org/spearce/jgit/lib/PackWriter.java       |    5 +++--
>  1 files changed, 3 insertions(+), 2 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 ea63942..3d7004d 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/PackWriter.java
> @@ -230,8 +230,8 @@ public class PackWriter {
>  	public PackWriter(final Repository repo, final ProgressMonitor imonitor,
>  			final ProgressMonitor wmonitor) {
>  		this.db = repo;
> -		initMonitor = imonitor;
> -		writeMonitor = wmonitor;
> +		initMonitor = (imonitor == null ? new NullProgressMonitor() : imonitor);
> +		writeMonitor = (wmonitor == null ? new NullProgressMonitor() : wmonitor);

Can't we use NullProgressMonitor.INSTANCE instead?

Also the () around the ?: expression are unnecessary here and our
coding style tends not to include them.

> @@ -829,6 +829,7 @@ public class PackWriter {
>  			RevObject o = walker.parseAny(id);
>  			walker.markStart(o);
>  		}
> +		if (uninterestingObjects != null)
>  		for (ObjectId id : uninterestingObjects) {

Please fix the indentation of the other code to be properly under
the if, or change the variable to be non-final and assign it
an empty list if its null, so the for() runs but doesn't crash.
Or do that in the only caller, preparePack(Collection,Collection).

-- 
Shawn.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-06 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06 19:57 [PATCH] Allow monitor/unintersting objects to be null Alex Blewitt
2009-05-06 20:02 ` 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).