@pierre/storage 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -6
- package/src/types.ts +1 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -363,6 +363,7 @@ class RepoImpl implements Repo {
|
|
|
363
363
|
|
|
364
364
|
constructor(
|
|
365
365
|
public readonly id: string,
|
|
366
|
+
public readonly defaultBranch: string,
|
|
366
367
|
private readonly options: GitStorageOptions,
|
|
367
368
|
private readonly generateJWT: (
|
|
368
369
|
repoId: string,
|
|
@@ -892,8 +893,8 @@ export class GitStorage {
|
|
|
892
893
|
}
|
|
893
894
|
: null;
|
|
894
895
|
|
|
895
|
-
//
|
|
896
|
-
const defaultBranch = options?.defaultBranch ?? 'main';
|
|
896
|
+
// Match backend priority: baseRepo.defaultBranch > options.defaultBranch > 'main'
|
|
897
|
+
const defaultBranch = options?.baseRepo?.defaultBranch ?? options?.defaultBranch ?? 'main';
|
|
897
898
|
|
|
898
899
|
const createRepoPath =
|
|
899
900
|
baseRepoOptions || defaultBranch
|
|
@@ -912,7 +913,7 @@ export class GitStorage {
|
|
|
912
913
|
throw new Error('Repository already exists');
|
|
913
914
|
}
|
|
914
915
|
|
|
915
|
-
return new RepoImpl(repoId, this.options, this.generateJWT.bind(this));
|
|
916
|
+
return new RepoImpl(repoId, defaultBranch, this.options, this.generateJWT.bind(this));
|
|
916
917
|
}
|
|
917
918
|
|
|
918
919
|
/**
|
|
@@ -931,9 +932,9 @@ export class GitStorage {
|
|
|
931
932
|
if (resp.status === 404) {
|
|
932
933
|
return null;
|
|
933
934
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
return new RepoImpl(options.id, this.options, this.generateJWT.bind(this));
|
|
935
|
+
const body = (await resp.json()) as { default_branch?: string };
|
|
936
|
+
const defaultBranch = body.default_branch ?? 'main';
|
|
937
|
+
return new RepoImpl(options.id, defaultBranch, this.options, this.generateJWT.bind(this));
|
|
937
938
|
}
|
|
938
939
|
|
|
939
940
|
/**
|
package/src/types.ts
CHANGED