Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb17fe1e

Browse files
Handle hidden refs (#1774)
Co-authored-by: Chris Gavin <chris@chrisgavin.me>
1 parentb80ff79 commitb17fe1e

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

‎__test__/ref-helper.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ describe('ref-helper tests', () => {
6767
expect(checkoutInfo.startPoint).toBeFalsy()
6868
})
6969

70+
it('getCheckoutInfo refs/',async()=>{
71+
constcheckoutInfo=awaitrefHelper.getCheckoutInfo(
72+
git,
73+
'refs/gh/queue/main/pr-123',
74+
commit
75+
)
76+
expect(checkoutInfo.ref).toBe(commit)
77+
expect(checkoutInfo.startPoint).toBeFalsy()
78+
})
79+
7080
it('getCheckoutInfo unqualified branch only',async()=>{
7181
git.branchExists=jest.fn(async(remote:boolean,pattern:string)=>{
7282
returntrue

‎dist/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,9 +2000,13 @@ function getCheckoutInfo(git, ref, commit) {
20002000
result.ref = `refs/remotes/pull/${branch}`;
20012001
}
20022002
// refs/tags/
2003-
else if (upperRef.startsWith('REFS/')) {
2003+
else if (upperRef.startsWith('REFS/TAGS/')) {
20042004
result.ref = ref;
20052005
}
2006+
// refs/
2007+
else if (upperRef.startsWith('REFS/') && commit) {
2008+
result.ref = commit;
2009+
}
20062010
// Unqualified ref, check for a matching branch or tag
20072011
else {
20082012
if (yield git.branchExists(true, `origin/${ref}`)) {

‎src/ref-helper.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ export async function getCheckoutInfo(
4242
result.ref=`refs/remotes/pull/${branch}`
4343
}
4444
// refs/tags/
45-
elseif(upperRef.startsWith('REFS/')){
45+
elseif(upperRef.startsWith('REFS/TAGS/')){
4646
result.ref=ref
4747
}
48+
// refs/
49+
elseif(upperRef.startsWith('REFS/')&&commit){
50+
result.ref=commit
51+
}
4852
// Unqualified ref, check for a matching branch or tag
4953
else{
5054
if(awaitgit.branchExists(true,`origin/${ref}`)){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp