Skip to content
This repository was archived by the owner on Nov 14, 2020. It is now read-only.

Commit 8704578

Browse files
committed
minor formatting changes and small change to folder details test script
1 parent 8f72562 commit 8704578

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

git/gitBranchDeleteApi.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const fetchRepopath = require("../global/fetchGitRepoPath");
1515
const gitDeleteBranchApi = async (repoId, branchName, forceFlag) => {
1616
try {
1717
branchName = branchName.trim();
18+
1819
if (branchName.match(/[^a-zA-Z0-9-_.:~@$^/\\s\\r\\n]/gi)) {
1920
throw new Error("Invalid branchName string!");
2021
}

git/gitCommitLogsAPI.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ const execPromisified = util.promisify(exec);
55

66
/**
77
* @param {String} repoId
8-
* @param {String} skipLimit=0 - git commit --skip limit to skip previous commits
9-
* @returns {Object} - commit details -
8+
* @param {number} skipLimit=0 - git commit --skip limit to skip previous commits
9+
* @returns {Array.<Object>} - commit details -
10+
* @description Commit logs of the selected repo will be returned
1011
*/
1112

1213
async function gitCommitLogHandler(repoId, skipLimit = 0) {
@@ -24,17 +25,15 @@ async function gitCommitLogHandler(repoId, skipLimit = 0) {
2425
const gitLocalTotal = stdout.trim().split("\n").length;
2526
return gitLocalTotal;
2627
} else {
27-
console.log(stderr);
28+
console.log("Error occurred while fetching all commits");
2829
return 0;
2930
}
3031
})
3132
.catch((err) => {
32-
console.log(err);
33+
console.log("Error occurred while fetching all commits");
3334
return 0;
3435
});
3536

36-
console.log("Total commits in the repo : ", totalCommits);
37-
3837
commitLogLimit = totalCommits < 10 ? totalCommits : 10;
3938

4039
if (!totalCommits || typeof skipLimit !== "number") {
@@ -91,12 +90,17 @@ async function gitCommitLogHandler(repoId, skipLimit = 0) {
9190
if (stdout) {
9291
return stdout.trim().split("\n").length;
9392
} else {
94-
console.log(stderr);
93+
console.log(
94+
"Error occurred while fetching all changed files from commit"
95+
);
9596
return 0;
9697
}
9798
})
9899
.catch((err) => {
99-
console.log(err);
100+
console.log(
101+
"Error occurred while fetching all changed files from commit"
102+
);
103+
100104
return 0;
101105
});
102106
commit += "||" + commitFilesCount;

tests/git-tests/gitFolderDetailsApi.test.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ const { getSelectedRepoId } = require("../common/fetchTestRepoId");
33

44
test("Test module for - gitFolderDetailsApi", async () => {
55
const repoId = await getSelectedRepoId();
6-
const { gitFileBasedCommit, gitTrackedFiles } = await (
7-
await gitFetchFolderContentApi(repoId, ".")
8-
).gitFolderContent;
6+
const { gitFolderContent } = await gitFetchFolderContentApi(repoId, ".");
7+
const { gitFileBasedCommit, gitTrackedFiles } = gitFolderContent;
98

109
expect(typeof gitFileBasedCommit).toBe("object");
1110
expect(gitFileBasedCommit.length).toBeGreaterThan(0);

0 commit comments

Comments
 (0)