Re: [PATCH] Allow monitor/unintersting objects to be null

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alex Blewitt <alex.blewitt@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]