Skip to content

Commit 774152b

Browse files
committed
Merge branch 'main' into lunny/automerge_support_delete_branch
2 parents f549185 + c09656e commit 774152b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ _test
99

1010
# IntelliJ
1111
.idea
12+
13+
# IntelliJ Gateway
14+
.uuid
15+
1216
# Goland's output filename can not be set manually
1317
/go_build_*
1418
/gitea_*

web_src/js/utils.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ test('parseIssueNewHref', () => {
4949
expect(parseIssueNewHref('/owner/repo/issues/new')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'});
5050
expect(parseIssueNewHref('/owner/repo/issues/new?query')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'});
5151
expect(parseIssueNewHref('/sub/owner/repo/issues/new#hash')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'issues'});
52+
expect(parseIssueNewHref('/sub/owner/repo/compare/feature/branch-1...fix/branch-2')).toEqual({ownerName: 'owner', repoName: 'repo', pathType: 'pulls'});
5253
});
5354

5455
test('parseUrl', () => {

web_src/js/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ export function parseIssueHref(href: string): IssuePathInfo {
3939

4040
export function parseIssueNewHref(href: string): IssuePathInfo {
4141
const path = (href || '').replace(/[#?].*$/, '');
42-
const [_, ownerName, repoName, pathType, indexString] = /([^/]+)\/([^/]+)\/(issues|pulls)\/new/.exec(path) || [];
43-
return {ownerName, repoName, pathType, indexString};
42+
const [_, ownerName, repoName, pathTypeField] = /([^/]+)\/([^/]+)\/(issues\/new|compare\/.+\.\.\.)/.exec(path) || [];
43+
const pathType = pathTypeField.startsWith('issues/new') ? 'issues' : 'pulls';
44+
return {ownerName, repoName, pathType};
4445
}
4546

4647
export function parseIssuePageInfo(): IssuePageInfo {

0 commit comments

Comments
 (0)