git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 6, 2009, 20:02 UTC
Message-ID
<20090506200235.GI30527@spearce.org>
In-Reply-To
<1241639836-6719-1-git-send-email-alex.blewitt@gmail.com>
Alex Blewitt <alex.blewitt@gmail.com> wrote:
Show 16 quoted lines
> ---
>  .../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.

Show 6 quoted lines
> @@ -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.
Previous: Alex Blewitt
Message 2 of 2 in “Allow monitor/unintersting objects to be null”
  1. Allow monitor/unintersting objects to be nullAlex Blewitt, May 6, 2009
  2. Shawn O. PearceMay 6, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.