diff options
author | Ivan Frade <ifrade@google.com> | 2023-11-07 14:00:05 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2023-11-07 14:00:05 -0800 |
commit | 5207bf0707b19d902a7a2994a1cc0634a23bb55c (patch) | |
tree | 9dff25fa1bdcc209603483c95353ab2fd407f2ad /org.eclipse.jgit | |
parent | c46b54eeac1cb2aaf62d4394fb7f60c848eab7b1 (diff) | |
download | jgit-5207bf0707b19d902a7a2994a1cc0634a23bb55c.tar.gz jgit-5207bf0707b19d902a7a2994a1cc0634a23bb55c.zip |
CommitGraphWriter: Use ProgressMonitor from the OutputStream
The same progress monitor is passed around as parameter and inside the
output stream. The functions use one to start tasks and another to
report progress, which is confusing. The stream needs the monitor to
check cancellations so we cannot remove it from there.
Make all code take the monitor from the stream.
Change-Id: Id3cb9c1cb0bd47318b46ef934a9d4037341e25a7
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java index 1c5f5b8521..e3ec4a5d6d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java @@ -134,7 +134,7 @@ public class CommitGraphWriter { monitor, commitGraphStream)) { writeHeader(out, chunks.size()); writeChunkLookup(out, chunks); - writeChunks(monitor, out, chunks); + writeChunks(out, chunks); writeCheckSum(out); if (expectedSize != out.length()) { throw new IllegalStateException(String.format( @@ -209,9 +209,8 @@ public class CommitGraphWriter { out.write(buffer); } - private void writeChunks(ProgressMonitor monitor, - CancellableDigestOutputStream out, List<ChunkHeader> chunks) - throws IOException { + private void writeChunks(CancellableDigestOutputStream out, + List<ChunkHeader> chunks) throws IOException { for (ChunkHeader chunk : chunks) { int chunkId = chunk.id; @@ -223,7 +222,7 @@ public class CommitGraphWriter { writeOidLookUp(out); break; case CHUNK_ID_COMMIT_DATA: - writeCommitData(monitor, out); + writeCommitData(out); break; case CHUNK_ID_EXTRA_EDGE_LIST: writeExtraEdges(out); @@ -277,8 +276,9 @@ public class CommitGraphWriter { } } - private void writeCommitData(ProgressMonitor monitor, - CancellableDigestOutputStream out) throws IOException { + private void writeCommitData(CancellableDigestOutputStream out) + throws IOException { + ProgressMonitor monitor = out.getWriteMonitor(); int[] generations = computeGenerationNumbers(monitor); monitor.beginTask(JGitText.get().writingOutCommitGraph, graphCommits.size()); @@ -319,7 +319,7 @@ public class CommitGraphWriter { NB.encodeInt32(tmp, hashsz + 12, packedDate[1]); out.write(tmp); - out.getWriteMonitor().update(1); + monitor.update(1); i++; } monitor.endTask(); |