aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/reference.ts
blob: 4e28e05dfbae23da664d88d30a4d0e8f082b799e (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
import { Reference as NodeGitReference } from "nodegit";
import { Repository } from "./repository";

/**
 * A representation of a reference
 */
export abstract class Reference {
	protected _ng_reference: NodeGitReference;
	protected _owner: Repository;

	public id: string;
	public name: string;

	/**
	 * @param owner - The repository which the reference is in
	 * @param reference - An instance of a Nodegit reference
	 */
	constructor(owner: Repository, reference: NodeGitReference) {
		this._ng_reference = reference;
		this._owner = owner;

		this.id = reference.target().tostrS();
		this.name = reference.shorthand();
	}
}