@@ -2,10 +2,10 @@ import { type PrismaClient, type PrismaClientOrTransaction } from "@trigger.dev/
2
2
import slug from "slug" ;
3
3
import { prisma } from "~/db.server" ;
4
4
import { createApiKeyForEnv , createPkApiKeyForEnv } from "~/models/api-key.server" ;
5
+ import { type CreateBranchOptions } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route" ;
6
+ import { isValidGitBranchName , sanitizeBranchName } from "~/v3/gitBranch" ;
5
7
import { logger } from "./logger.server" ;
6
8
import { getLimit } from "./platform.v3.server" ;
7
- import { type CreateBranchOptions } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route" ;
8
- import { isValidGitBranchName } from "~/v3/validGitBranch" ;
9
9
10
10
export class UpsertBranchService {
11
11
#prismaClient: PrismaClient ;
@@ -167,17 +167,3 @@ export async function checkBranchLimit(
167
167
isAtLimit : used >= limit ,
168
168
} ;
169
169
}
170
-
171
- export function sanitizeBranchName ( ref : string ) : string | null {
172
- if ( ! ref ) return null ;
173
- if ( ref . startsWith ( "refs/heads/" ) ) return ref . substring ( "refs/heads/" . length ) ;
174
- if ( ref . startsWith ( "refs/remotes/" ) ) return ref . substring ( "refs/remotes/" . length ) ;
175
- if ( ref . startsWith ( "refs/tags/" ) ) return ref . substring ( "refs/tags/" . length ) ;
176
- if ( ref . startsWith ( "refs/pull/" ) ) return ref . substring ( "refs/pull/" . length ) ;
177
- if ( ref . startsWith ( "refs/merge/" ) ) return ref . substring ( "refs/merge/" . length ) ;
178
- if ( ref . startsWith ( "refs/release/" ) ) return ref . substring ( "refs/release/" . length ) ;
179
- //unknown ref format, so reject
180
- if ( ref . startsWith ( "refs/" ) ) return null ;
181
-
182
- return ref ;
183
- }
0 commit comments