blob: ca25212e00562c16b5d2fd6c182d55a74a6aa5b6 [file] [log] [blame]
/*
* Copyright (C) 2010, Google Inc. and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.internal.storage.file;
import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
import org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation;
import org.eclipse.jgit.lib.AnyObjectId;
/** {@link ObjectToPack} for {@link ObjectDirectory}. */
class LocalObjectToPack extends ObjectToPack {
/** Pack to reuse compressed data from, otherwise null. */
Pack pack;
/** Offset of the object's header in {@link #pack}. */
long offset;
/** Length of the data section of the object. */
long length;
LocalObjectToPack(AnyObjectId src, int type) {
super(src, type);
}
@Override
protected void clearReuseAsIs() {
super.clearReuseAsIs();
pack = null;
}
@Override
public void select(StoredObjectRepresentation ref) {
LocalObjectRepresentation ptr = (LocalObjectRepresentation) ref;
this.pack = ptr.pack;
this.offset = ptr.offset;
this.length = ptr.length;
}
}