added possibility to ignore MagicMirror repo in updatenotification (#3002)

was [requested in the
forum](https://forum.magicmirror.builders/topic/17519/updatenotification).

- added possibility to exclude MagicMirror Repo and renamed it from
`default` to `MagicMirror`
- improved getting `behind` in case a hard `git fetch` was already done
- removed test "excludes repo if refs don't match regex" because of
above improvement this case is obsolete
- improved `git fetch --dry-run` with `-n` option to exclude tags (noise
reduction)
This commit is contained in:
Karsten Hassel
2023-01-12 09:14:20 +01:00
committed by GitHub
parent 877f8ad380
commit 29e3ec06cb
7 changed files with 22 additions and 24 deletions

View File

@@ -11,24 +11,24 @@ exports[`Updatenotification custom module returns status information without has
}
`;
exports[`Updatenotification default returns status information 1`] = `
exports[`Updatenotification MagicMirror returns status information 1`] = `
{
"behind": 5,
"current": "develop",
"hash": "332e429a41f1a2339afd4f0ae96dd125da6beada",
"isBehindInStatus": false,
"module": "default",
"module": "MagicMirror",
"tracking": "origin/develop",
}
`;
exports[`Updatenotification default returns status information early if isBehindInStatus 1`] = `
exports[`Updatenotification MagicMirror returns status information early if isBehindInStatus 1`] = `
{
"behind": 5,
"current": "develop",
"hash": "332e429a41f1a2339afd4f0ae96dd125da6beada",
"isBehindInStatus": true,
"module": "default",
"module": "MagicMirror",
"tracking": "origin/develop",
}
`;

View File

@@ -57,7 +57,7 @@ describe("Updatenotification", () => {
return { stdout: gitRevParseOut, stderr: gitRevParseErr };
} else if (command.includes("git status -sb")) {
return { stdout: gitStatusOut, stderr: gitStatusErr };
} else if (command.includes("git fetch --dry-run")) {
} else if (command.includes("git fetch -n --dry-run")) {
return { stdout: gitFetchOut, stderr: gitFetchErr };
} else if (command.includes("git rev-list --ancestry-path --count")) {
return { stdout: gitRevListOut, stderr: gitRevListErr };
@@ -71,8 +71,8 @@ describe("Updatenotification", () => {
jest.clearAllMocks();
});
describe("default", () => {
const moduleName = "default";
describe("MagicMirror", () => {
const moduleName = "MagicMirror";
beforeEach(async () => {
gitRemoteOut = "origin\tgit@github.com:MichMich/MagicMirror.git (fetch)\norigin\tgit@github.com:MichMich/MagicMirror.git (push)\n";
@@ -108,13 +108,6 @@ describe("Updatenotification", () => {
const { error } = require("logger");
expect(error).toHaveBeenCalledWith(`Failed to retrieve repo info for ${moduleName}: Failed to retrieve status`);
});
it("excludes repo if refs don't match regex", async () => {
gitFetchErr = "";
const repos = await gitHelper.getRepos();
expect(repos.length).toBe(0);
});
});
describe("custom module", () => {