mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-12 07:12:54 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
70
packages/noodl-git/src/models.ts
Normal file
70
packages/noodl-git/src/models.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
// This is the models used by Noold right now
|
||||
import { ICloneProgress } from "./core/models/progress";
|
||||
|
||||
import { FileStatusKind } from "./core/models/status";
|
||||
|
||||
export type GitUserInfo = {
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
|
||||
export type GitStatus = {
|
||||
status: "new" | "modified" | "deleted" | "conflicted";
|
||||
path: string;
|
||||
};
|
||||
|
||||
export function ConvertStatusKindToGitStatus(
|
||||
x: FileStatusKind
|
||||
): GitStatus["status"] {
|
||||
switch (x) {
|
||||
case FileStatusKind.New:
|
||||
return "new";
|
||||
case FileStatusKind.Modified:
|
||||
return "modified";
|
||||
case FileStatusKind.Deleted:
|
||||
return "deleted";
|
||||
case FileStatusKind.Copied:
|
||||
return "modified";
|
||||
case FileStatusKind.Renamed:
|
||||
return "modified";
|
||||
case FileStatusKind.Conflicted:
|
||||
return "conflicted";
|
||||
case FileStatusKind.Untracked:
|
||||
return "new";
|
||||
}
|
||||
}
|
||||
|
||||
export type GitCommit = {
|
||||
sha: string;
|
||||
shortSha: string;
|
||||
message: string;
|
||||
date: Date;
|
||||
parentCount: number;
|
||||
author: {
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
|
||||
isLocalAhead: boolean;
|
||||
isRemoteAhead: boolean;
|
||||
};
|
||||
|
||||
export type GitBranch = {
|
||||
name: string;
|
||||
local: boolean;
|
||||
remote: boolean;
|
||||
};
|
||||
|
||||
export type GitCloneOptions = {
|
||||
url: string;
|
||||
directory: string;
|
||||
/** Clone a single branch; this if only for testing. */
|
||||
singleBranch?: boolean;
|
||||
onProgress?: (progress: ICloneProgress) => void;
|
||||
};
|
||||
|
||||
export class GitEmptyRepositoryError extends Error {
|
||||
constructor() {
|
||||
super("The repository you're trying to clone is empty.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user