You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LocalObjectToPack.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2010, Google Inc. and others
  3. *
  4. * This program and the accompanying materials are made available under the
  5. * terms of the Eclipse Distribution License v. 1.0 which is available at
  6. * https://www.eclipse.org/org/documents/edl-v10.php.
  7. *
  8. * SPDX-License-Identifier: BSD-3-Clause
  9. */
  10. package org.eclipse.jgit.internal.storage.file;
  11. import org.eclipse.jgit.internal.storage.pack.ObjectToPack;
  12. import org.eclipse.jgit.internal.storage.pack.StoredObjectRepresentation;
  13. import org.eclipse.jgit.lib.AnyObjectId;
  14. /** {@link ObjectToPack} for {@link ObjectDirectory}. */
  15. class LocalObjectToPack extends ObjectToPack {
  16. /** Pack to reuse compressed data from, otherwise null. */
  17. Pack pack;
  18. /** Offset of the object's header in {@link #pack}. */
  19. long offset;
  20. /** Length of the data section of the object. */
  21. long length;
  22. LocalObjectToPack(AnyObjectId src, int type) {
  23. super(src, type);
  24. }
  25. /** {@inheritDoc} */
  26. @Override
  27. protected void clearReuseAsIs() {
  28. super.clearReuseAsIs();
  29. pack = null;
  30. }
  31. /** {@inheritDoc} */
  32. @Override
  33. public void select(StoredObjectRepresentation ref) {
  34. LocalObjectRepresentation ptr = (LocalObjectRepresentation) ref;
  35. this.pack = ptr.pack;
  36. this.offset = ptr.offset;
  37. this.length = ptr.length;
  38. }
  39. }