forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloading.js
50 lines (41 loc) · 1.12 KB
/
loading.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import State from './state';
/**
* Initial state to be used when it's uncertain whether or not a git repository is present in a working directory. If
* it is a git repository, transition to Present, otherwise transition to Empty.
*/
export default class Loading extends State {
async start() {
const dotGitDir = await this.resolveDotGitDir();
if (dotGitDir) {
this.repository.setGitDirectoryPath(dotGitDir);
const history = await this.loadHistoryPayload();
return this.transitionTo('Present', history);
} else {
return this.transitionTo('Empty');
}
}
isLoading() {
return true;
}
async init() {
await this.getLoadPromise();
await this.repository.init();
}
async clone(remoteUrl) {
await this.getLoadPromise();
await this.repository.clone(remoteUrl);
}
showGitTabLoading() {
return true;
}
directResolveDotGitDir() {
return this.git().resolveDotGitDir();
}
directGetConfig(key, options) {
return this.git().getConfig(key, options);
}
directGetBlobContents(sha) {
return this.git().getBlobContents(sha);
}
}
State.register(Loading);