aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/api/util.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-06-24 22:50:38 +0200
committerHampusM <hampus@hampusmat.com>2021-06-24 22:50:38 +0200
commita13786d6cc185822f5940582efde2349ef729145 (patch)
tree7d4f49b50fc30ced65c5661b22b027456b79948e /packages/server/src/api/util.ts
parent01e5d215dbc152e34ecd005111171457f87c235d (diff)
Refactored the backend yet again
Diffstat (limited to 'packages/server/src/api/util.ts')
-rw-r--r--packages/server/src/api/util.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/packages/server/src/api/util.ts b/packages/server/src/api/util.ts
index b05ebb7..e1eaa2c 100644
--- a/packages/server/src/api/util.ts
+++ b/packages/server/src/api/util.ts
@@ -1,5 +1,6 @@
-import { GitAPI } from "./git";
-import { RequestInfo } from "./git_types";
+import { Commit } from "../git/commit";
+import { Repository } from "../git/repository";
+import { RequestInfo } from "../git/http";
import { readdir } from "fs";
type VerificationResultType = "SUCCESS" | "NOT_FOUND" | "INVALID" | "ACCESS_DENIED";
@@ -51,12 +52,12 @@ export function verifyRepoName(base_dir: string, repo_name: string): Promise<Ver
});
}
-export async function verifySHA(git: GitAPI, repo_name: string, sha: string): Promise<VerificationResult> {
+export async function verifySHA(repository: Repository, sha: string): Promise<VerificationResult> {
if(!(/^[a-fA-F0-9]+$/u).test(sha)) {
return new VerificationResult("INVALID", "sha");
}
- const object_exists = await git.doesObjectExist(repo_name, sha);
+ const object_exists = await Commit.lookupExists(repository, sha);
if(!object_exists) {
return new VerificationResult("NOT_FOUND", "object");