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

[PATCH 2/2] Use NullProgressMonitor.INSTANCE and indent for loop

From
Alex Blewitt <alex.blewitt@gmail.com>
Date
May 6, 2009, 20:37 UTC
Message-ID
<1241642224-6914-2-git-send-email-alex.blewitt@gmail.com>
In-Reply-To
<1241642224-6914-1-git-send-email-alex.blewitt@gmail.com>
---
 .../src/org/spearce/jgit/lib/PackWriter.java       |   25 ++++++++++---------
 1 files changed, 13 insertions(+), 12 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 3d7004d..a35f61d 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 PackWriter(final Repository repo, final ProgressMonitor monitor) {
 	public PackWriter(final Repository repo, final ProgressMonitor imonitor,
 			final ProgressMonitor wmonitor) {
 		this.db = repo;
-		initMonitor = (imonitor == null ? new NullProgressMonitor() : imonitor);
-		writeMonitor = (wmonitor == null ? new NullProgressMonitor() : wmonitor);
+		initMonitor = imonitor == null ? NullProgressMonitor.INSTANCE : imonitor;
+		writeMonitor = wmonitor == null ? NullProgressMonitor.INSTANCE : wmonitor;
 		this.deflater = new Deflater(db.getConfig().getCore().getCompression());
 		outputVersion = repo.getConfig().getCore().getPackIndexVersion();
 	}
@@ -829,17 +829,18 @@ private ObjectWalk setUpWalker(
 			RevObject o = walker.parseAny(id);
 			walker.markStart(o);
 		}
-		if (uninterestingObjects != null)
-		for (ObjectId id : uninterestingObjects) {
-			final RevObject o;
-			try {
-				o = walker.parseAny(id);
-			} catch (MissingObjectException x) {
-				if (ignoreMissingUninteresting)
-					continue;
-				throw x;
+		if (uninterestingObjects != null) {
+			for (ObjectId id : uninterestingObjects) {
+				final RevObject o;
+				try {
+					o = walker.parseAny(id);
+				} catch (MissingObjectException x) {
+					if (ignoreMissingUninteresting)
+						continue;
+					throw x;
+				}
+				walker.markUninteresting(o);
 			}
-			walker.markUninteresting(o);
 		}
 		return walker;
 	}
-- 
1.6.2.2
Previous: Alex BlewittNext: Shawn O. Pearce
Message 2 of 8 in “Allow monitor/unintersting objects to be null”
  1. 1/2 Allow monitor/unintersting objects to be nullAlex Blewitt, May 6, 2009
  2. 2/2 Use NullProgressMonitor.INSTANCE and indent for loopAlex Blewitt, May 6, 2009
  3. Shawn O. PearceMay 6, 2009
  4. Shawn O. PearceMay 6, 2009
  5. Alex BlewittMay 6, 2009
  6. Shawn O. PearceMay 6, 2009
  7. Robin RosenbergMay 6, 2009
  8. Alex BlewittMay 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.