()
| 67 | } |
| 68 | |
| 69 | async initialize(): Promise<void> { |
| 70 | return withLogTags( |
| 71 | { source: 'GitRepositoryDO', tags: { appId: this.ctx.id.name } }, |
| 72 | async () => { |
| 73 | if (!this.fs) { |
| 74 | await this.initializeFS(); |
| 75 | } |
| 76 | |
| 77 | if (this._initialized) { |
| 78 | logger.debug('Repository already initialized'); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | logger.debug('Initializing new git repository'); |
| 83 | |
| 84 | if (!this.fs) { |
| 85 | throw new Error('Filesystem not initialized'); |
| 86 | } |
| 87 | |
| 88 | await git.init({ fs: this.fs, dir: '/', defaultBranch: 'main' }); |
| 89 | this._initialized = true; |
| 90 | |
| 91 | logger.debug('Git repository initialized successfully'); |
| 92 | } |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Files are expected to have base64-encoded content to safely handle binary data through RPC |
no test coverage detected