aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitmoduleEntry.java
blob: d93a09623c8b0dd4333d44f4a966193fb80b8d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (C) 2018, Google LLC. 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.lib;

import org.eclipse.jgit.lib.AnyObjectId;

/**
 * A .gitmodules file found in the pack. Store the blob of the file itself (e.g.
 * to access its contents) and the tree where it was found (e.g. to check if it
 * is in the root)
 *
 * @since 4.7.5
 */
public final class GitmoduleEntry {
	private final AnyObjectId treeId;

	private final AnyObjectId blobId;

	/**
	 * A record of (tree, blob) for a .gitmodule file in a pack
	 *
	 * @param treeId
	 *            tree id containing a .gitmodules entry
	 * @param blobId
	 *            id of the blob of the .gitmodules file
	 */
	public GitmoduleEntry(AnyObjectId treeId, AnyObjectId blobId) {
		// AnyObjectId's are reused, must keep a copy.
		this.treeId = treeId.copy();
		this.blobId = blobId.copy();
	}

	/**
	 * @return Id of a .gitmodules file found in the pack
	 */
	public AnyObjectId getBlobId() {
		return blobId;
	}

	/**
	 * @return Id of a tree object where the .gitmodules file was found
	 */
	public AnyObjectId getTreeId() {
		return treeId;
	}
}