Skip to content

Commit f058041

Browse files
authored
Update repos.js
1 parent a624767 commit f058041

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

repos.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ function addRepoToModRepos(repoObj) {
2626

2727
}
2828

29+
function removeRepoFromModRepos(fullName) {
30+
31+
delete modifiedRepos[fullName];
32+
33+
updateModReposLS();
34+
35+
}
36+
2937
function updateModRepoSelectedBranch(fullName, selBranch) {
3038

3139
modifiedRepos[fullName].selBranch = selBranch;
@@ -72,19 +80,51 @@ function updateModRepoEmptyStatus(fullName, empty) {
7280
// and save to modified repos
7381
async function fetchRepoAndSaveToModRepos(treeLoc) {
7482

83+
// get full name of repository
84+
const fullName = treeLoc[0] + '/' + treeLoc[1].split(':')[0];
85+
const selBranch = treeLoc[1].split(':')[1];
86+
87+
88+
// create temporary repo object
89+
const tempRepoObj = createRepoObj(fullName, selBranch, null,
90+
null, null, null, null);
91+
92+
// add temp repo object
93+
// to modified repos
94+
addRepoToModRepos(tempRepoObj);
95+
96+
7597
// get repository from git
7698
const repo = await git.getRepo(treeLoc);
7799

100+
78101
// if didn't encounter an error
79102
if (!repo.message) {
80103

104+
// if temp repo changed,
105+
const tempRepo = modifiedRepos[fullName];
106+
81107
// create repo obj
82-
const repoObj = createRepoObj(repo.full_name, repo.default_branch, (repo.permissions.push ?? false),
83-
null, repo.private, repo.fork, false);
84-
85-
// add repo to modified repos
108+
const repoObj = createRepoObj(fullName, repo.default_branch,
109+
110+
(tempRepo.pushAccess ?? (repo.permissions.push ?? false)),
111+
112+
(tempRepo.branches ?? null),
113+
114+
repo.private, repo.fork,
115+
116+
(tempRepo.empty ?? false));
117+
118+
// add repo object
119+
// to modified repos
86120
addRepoToModRepos(repoObj);
87121

122+
} else {
123+
124+
// remove temp repo object
125+
// from modified repos
126+
removeRepoFromModRepos(fullName);
127+
88128
}
89129

90130
}

0 commit comments

Comments
 (0)