git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Alex Blewitt <alex.blewitt@gmail.com>
Cc: robin.rosenberg@dewire.com, git@vger.kernel.org
Subject: Re: [PATCH] Allow monitor/unintersting objects to be null
Date: Wed, 6 May 2009 13:02:35 -0700	[thread overview]
Message-ID: <20090506200235.GI30527@spearce.org> (raw)
In-Reply-To: <1241639836-6719-1-git-send-email-alex.blewitt@gmail.com>

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.

      reply	other threads:[~2009-05-06 20:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 19:57 [PATCH] Allow monitor/unintersting objects to be null Alex Blewitt
2009-05-06 20:02 ` Shawn O. Pearce [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090506200235.GI30527@spearce.org \
    --to=spearce@spearce.org \
    --cc=alex.blewitt@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).