Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class ActionOutputPrinter {
if (this.config.searchFor) searchOutputForHints(this.config, stdoutBuffer);
if (stdoutBuffer.length === 0) {
console.log(
chalk`{yellow No groups found for action {cyan ${this.actionToRun}} and group {cyan ${this.groupToRun}}}`,
chalk`{yellow No groups found for action {cyan ${this.actionToRun}} and group in {cyan ${this.groupToRun}}}`,
);
}
fs.writeFileSync(path.join(this.config.cwd, ".output.json"), JSON.stringify(stdoutBuffer));
Expand Down
6 changes: 4 additions & 2 deletions src/gitops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ async function pull(dir: string, currentBranch: string, log: LogFn) {

if (err || !res) {
if (`${err?.stderr}`.trim().startsWith("There is no tracking information for the current branch")) {
log(chalk`{cyan ${currentBranch}} {red doesn't have a remote origin} {cyan ${dir}}`);
log(chalk`{cyan ${currentBranch}} {red doesn't have a remote origin} in {cyan ${dir}}`);
} else if (`${err?.stderr}`.trim().startsWith(`Your configuration specifies to merge with the ref`)) {
log(chalk`{cyan ${currentBranch}} {red no such ref could be fetched} in {cyan ${dir}}`);
} else {
log(chalk`{cyan ${currentBranch}} {red conflicts} with {magenta origin/${currentBranch}} {cyan ${dir}}`);
log(chalk`{cyan ${currentBranch}} {red conflicts} with {magenta origin/${currentBranch}} in {cyan ${dir}}`);
}
return false;
}
Expand Down
16 changes: 14 additions & 2 deletions tests/gitops.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("Git Operations", () => {

const logs = await gitops(cwdStub, projectStub);

expect(logs).toContain(chalk`{cyan main} {red doesn't have a remote origin} {cyan ${cwdStub}/cego/example}`);
expect(logs).toContain(chalk`{cyan main} {red doesn't have a remote origin} in {cyan ${cwdStub}/cego/example}`);
});

test("Already up to date", async () => {
Expand All @@ -111,14 +111,26 @@ describe("Git Operations", () => {
expect(spawnSpy).toHaveBeenCalledWith("git", ["pull", "--ff-only"], expect.objectContaining({}));
});

test("Remote ref has gone away", async () => {
mockHasNoChanges();
when(spawnSpy)
.calledWith("git", ["pull", "--ff-only"], expect.objectContaining({}))
.mockRejectedValue({ stderr: "Your configuration specifies to merge with the ref" });

const logs = await gitops(cwdStub, projectStub);
const msg = chalk`{cyan main} {red no such ref could be fetched} in {cyan ${cwdStub}/cego/example}`;
expect(logs).toContain(msg);
expect(spawnSpy).toHaveBeenCalledWith("git", ["pull", "--ff-only"], expect.objectContaining({}));
});

test("Conflicts with origin", async () => {
mockHasNoChanges();
when(spawnSpy)
.calledWith("git", ["pull", "--ff-only"], expect.objectContaining({}))
.mockRejectedValue({ stderr: "I'M IN CONFLICT" });

const logs = await gitops(cwdStub, projectStub);
const msg = chalk`{cyan main} {red conflicts} with {magenta origin/main} {cyan ${cwdStub}/cego/example}`;
const msg = chalk`{cyan main} {red conflicts} with {magenta origin/main} in {cyan ${cwdStub}/cego/example}`;
expect(logs).toContain(msg);
});
});
Expand Down