1 /*
2 * Copyright (C) 2018, Google LLC. 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.lib;
11
12 /**
13 * A .gitmodules file found in the pack. Store the blob of the file itself (e.g.
14 * to access its contents) and the tree where it was found (e.g. to check if it
15 * is in the root)
16 *
17 * @since 4.7.5
18 */
19 public final class GitmoduleEntry {
20 private final AnyObjectId treeId;
21
22 private final AnyObjectId blobId;
23
24 /**
25 * A record of (tree, blob) for a .gitmodule file in a pack
26 *
27 * @param treeId
28 * tree id containing a .gitmodules entry
29 * @param blobId
30 * id of the blob of the .gitmodules file
31 */
32 public GitmoduleEntry(AnyObjectId../../../org/eclipse/jgit/lib/AnyObjectId.html#AnyObjectId">AnyObjectId treeId, AnyObjectId blobId) {
33 // AnyObjectId's are reused, must keep a copy.
34 this.treeId = treeId.copy();
35 this.blobId = blobId.copy();
36 }
37
38 /**
39 * @return Id of a .gitmodules file found in the pack
40 */
41 public AnyObjectId getBlobId() {
42 return blobId;
43 }
44
45 /**
46 * @return Id of a tree object where the .gitmodules file was found
47 */
48 public AnyObjectId getTreeId() {
49 return treeId;
50 }
51 }