UNPKG

3.71 kBTypeScriptView Raw
1
2export interface BranchDeletionSummary {
3 branch: string;
4 hash: any;
5 success: boolean;
6}
7
8 export interface BranchSummary {
9 detached: boolean;
10 current: string;
11 all: string[];
12 branches: {[key: string]: {
13 current: string,
14 name: string,
15 commit: string,
16 label: string
17 }};
18 }
19
20export interface CommitSummary {
21 author: null | {
22 email: string;
23 name: string;
24 };
25 branch: string;
26 commit: string;
27 summary: {
28 changes: number;
29 insertions: number;
30 deletions: number;
31 };
32}
33
34export interface DiffResultTextFile {
35 file: string;
36 changes: number,
37 insertions: number;
38 deletions: number;
39 binary: boolean;
40}
41
42export interface DiffResultBinaryFile {
43 file: string;
44 before: number;
45 after: number;
46 binary: boolean;
47}
48
49export interface DiffResult {
50 /** The total number of files changed as reported in the summary line */
51 changed: number;
52
53 /** When present in the diff, lists the details of each file changed */
54 files: Array<DiffResultTextFile | DiffResultBinaryFile>;
55
56 /** The number of files changed with insertions */
57 insertions: number;
58
59 /** The number of files changed with deletions */
60 deletions: number;
61}
62
63export interface FetchResult {
64 raw: string;
65 remote: string | null;
66 branches: {
67 name: string;
68 tracking: string;
69 }[];
70 tags: {
71 name: string;
72 tracking: string;
73 }[];
74}
75
76export interface MoveSummary {
77 moves: any[];
78}
79
80export interface PullResult {
81
82 /** Array of all files that are referenced in the pull */
83 files: string[];
84
85 /** Map of file names to the number of insertions in that file */
86 insertions: {[key: string]: number};
87
88 /** Map of file names to the number of deletions in that file */
89 deletions: any;
90
91 summary: {
92 changes: number;
93 insertions: number;
94 deletions: number;
95 };
96
97 /** Array of file names that have been created */
98 created: string[];
99
100 /** Array of file names that have been deleted */
101 deleted: string[];
102}
103
104export interface RemoteWithoutRefs {
105 name: string;
106}
107
108export interface RemoteWithRefs extends RemoteWithoutRefs {
109 refs: {
110 fetch: string;
111 push: string;
112 }
113}
114
115export interface StatusResultRenamed {
116 from: string;
117 to: string;
118}
119
120export interface StatusResult {
121 not_added: string[];
122 conflicted: string[];
123 created: string[];
124 deleted: string[];
125 modified: string[];
126 renamed: StatusResultRenamed[];
127 staged: string[];
128 files: {
129 path: string;
130 index: string;
131 working_dir: string;
132 }[];
133 ahead: number;
134 behind: number;
135 current: string;
136 tracking: string;
137
138 /**
139 * Gets whether this represents a clean working branch.
140 */
141 isClean(): boolean;
142}
143
144export interface TagResult {
145 all: string[];
146 latest: string;
147}
148
149export interface DefaultLogFields {
150 hash: string;
151 date: string;
152 message: string;
153 refs: string;
154 body: string;
155 author_name: string;
156 author_email: string;
157}
158
159/**
160 * The ListLogLine represents a single entry in the `git.log`, the properties on the object
161 * are mixed in depending on the names used in the format (see `DefaultLogFields`), but some
162 * properties are dependent on the command used.
163 */
164export interface ListLogLine {
165
166 /**
167 * When using a `--stat=4096` or `--shortstat` options in the `git.log` or `git.stashList`,
168 * each entry in the `ListLogSummary` will also have a `diff` property representing as much
169 * detail as was given in the response.
170 */
171 diff?: DiffResult;
172}
173
174export interface ListLogSummary<T = DefaultLogFields> {
175 all: ReadonlyArray<T & ListLogLine>;
176 total: number;
177 latest: T & ListLogLine;
178}