From 241eed844da1c00862b81701c07a08534b5a382e Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Thu, 4 Apr 2013 17:50:32 -0700 Subject: [PATCH] Move wantWrite flag to be special offset 1 Free up the WANT_WRITE flag in ObjectToPack by switching the test to use the special offset value of 1. The Git pack file format calls for the first 4 bytes to be 'PACK', which means any object must start at an offset >= 4. Current versions require another 8 bytes in the header, placing the first object at offset = 12. So offset = 1 is an invalid location for an object, and can be used as a marker signal to indicate the writing loop has tried to write the object, but recursed into the base first. When an object is visited with offset == 1 it means there is a cycle in the delta base path, and the cycle must be broken. Change-Id: I2d05b9017c5f9bd9464b91d43e8d4b4a085e55bc --- .../jgit/internal/storage/pack/ObjectToPack.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java index 57346ab51a..c9f4274eea 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/ObjectToPack.java @@ -57,8 +57,6 @@ import org.eclipse.jgit.transport.PackedObjectInfo; * each object as they are written to the output stream. */ public class ObjectToPack extends PackedObjectInfo { - private static final int WANT_WRITE = 1 << 0; - private static final int REUSE_AS_IS = 1 << 1; private static final int DO_NOT_DELTA = 1 << 2; @@ -87,7 +85,7 @@ public class ObjectToPack extends PackedObjectInfo { /** * Bit field, from bit 0 to bit 31: *