diff --git a/src/plugins/git/loadRepository.js b/src/plugins/git/loadRepository.js index 2503cd6..d4477c1 100644 --- a/src/plugins/git/loadRepository.js +++ b/src/plugins/git/loadRepository.js @@ -11,6 +11,8 @@ import {execFileSync} from "child_process"; +import type {Repository, Hash, Commit, Tree, TreeEntry} from "./types"; + export type GitDriver = (args: string[], options?: ExecOptions) => string; type ExecOptions = Object; // close enough export function localGit(repositoryPath: string): GitDriver { @@ -24,25 +26,6 @@ export function localGit(repositoryPath: string): GitDriver { }; } -export type Repository = {| - +commits: Map, - +trees: Map, -|}; -export type Hash = string; -export type Commit = {| - +hash: Hash, - +treeHash: Hash, -|}; -export type Tree = {| - +hash: Hash, - +entries: Map, // map from name -|}; -export type TreeEntry = {| - +type: "blob" | "commit" | "tree", - +name: string, - +hash: Hash, -|}; - /** * Load a Git repository from disk into memory. The `rootRef` should be * a revision reference as accepted by `git rev-parse`: "HEAD" and diff --git a/src/plugins/git/types.js b/src/plugins/git/types.js new file mode 100644 index 0000000..74c0147 --- /dev/null +++ b/src/plugins/git/types.js @@ -0,0 +1,20 @@ +// @flow + +export type Repository = {| + +commits: Map, + +trees: Map, +|}; +export type Hash = string; +export type Commit = {| + +hash: Hash, + +treeHash: Hash, +|}; +export type Tree = {| + +hash: Hash, + +entries: Map, // map from name +|}; +export type TreeEntry = {| + +type: "blob" | "commit" | "tree", + +name: string, + +hash: Hash, +|};