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
9 changes: 9 additions & 0 deletions packages/source-control-gitlab/src/shared/definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ describe("GitLab change request URLs", () => {
});
});

describe("GitLab CLI commands", () => {
it("recognizes shell merges and closes, including glab's `accept` alias", () => {
for (const command of ["glab mr merge 7 --yes", "glab mr accept 7 --yes", "glab mr close 7"]) {
expect(definition.changeRequestCloseCommand.test(command), command).toBe(true);
}
expect(definition.changeRequestCloseCommand.test("glab mr view 7")).toBe(false);
});
});

describe("GitLab remotes", () => {
const recognize = (url: string) => recognizeRemoteWith(definition, url);

Expand Down
3 changes: 2 additions & 1 deletion packages/source-control-gitlab/src/shared/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export const definition = defineSourceControl({
"delete-branch",
] as const),
checkoutCommand: ({ number }) => `glab mr checkout ${number}`,
changeRequestCloseCommand: /\bglab\s+mr\s+(?:merge|close)\b/u,
// `accept` is glab's alias for `merge`.
changeRequestCloseCommand: /\bglab\s+mr\s+(?:merge|accept|close)\b/u,
changeRequestCreateCommand: /\bglab\s+mr\s+create\b/u,
// Bot users, unlike GitHub's, have real profile pages.
authorProfileUrl: (login, repositoryUrl) =>
Expand Down
Loading