File tree Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Expand file tree Collapse file tree 1 file changed +3
-19
lines changed Original file line number Diff line number Diff line change @@ -111,24 +111,6 @@ async function createBranch(
111
111
return GitLabReferenceSchema . parse ( await response . json ( ) ) ;
112
112
}
113
113
114
- async function getDefaultBranchRef ( projectId : string ) : Promise < string > {
115
- const response = await fetch (
116
- `${ GITLAB_API_URL } /projects/${ encodeURIComponent ( projectId ) } ` ,
117
- {
118
- headers : {
119
- "Authorization" : `Bearer ${ GITLAB_PERSONAL_ACCESS_TOKEN } `
120
- }
121
- }
122
- ) ;
123
-
124
- if ( ! response . ok ) {
125
- throw new Error ( `GitLab API error: ${ response . statusText } ` ) ;
126
- }
127
-
128
- const project = GitLabRepositorySchema . parse ( await response . json ( ) ) ;
129
- return project . default_branch ;
130
- }
131
-
132
114
async function getFileContents (
133
115
projectId : string ,
134
116
filePath : string ,
@@ -138,6 +120,8 @@ async function getFileContents(
138
120
let url = `${ GITLAB_API_URL } /projects/${ encodeURIComponent ( projectId ) } /repository/files/${ encodedPath } ` ;
139
121
if ( ref ) {
140
122
url += `?ref=${ encodeURIComponent ( ref ) } ` ;
123
+ } else {
124
+ url += '?ref=HEAD' ;
141
125
}
142
126
143
127
const response = await fetch ( url , {
@@ -444,7 +428,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
444
428
const args = CreateBranchSchema . parse ( request . params . arguments ) ;
445
429
let ref = args . ref ;
446
430
if ( ! ref ) {
447
- ref = await getDefaultBranchRef ( args . project_id ) ;
431
+ ref = "HEAD" ;
448
432
}
449
433
450
434
const branch = await createBranch ( args . project_id , {
You can’t perform that action at this time.
0 commit comments