Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/__test__/git-command-manager.test.ts
diff options
context:
space:
mode:
Diffstat (limited to '__test__/git-command-manager.test.ts')
-rw-r--r--__test__/git-command-manager.test.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/__test__/git-command-manager.test.ts b/__test__/git-command-manager.test.ts
index 8a97d82..47a0f8f 100644
--- a/__test__/git-command-manager.test.ts
+++ b/__test__/git-command-manager.test.ts
@@ -378,6 +378,59 @@ describe('Test fetchDepth and fetchTags options', () => {
})
})
+describe('repository initialization object format', () => {
+ beforeEach(async () => {
+ jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn())
+ jest.spyOn(fshelper, 'directoryExistsSync').mockImplementation(jest.fn())
+ })
+
+ afterEach(() => {
+ jest.restoreAllMocks()
+ })
+
+ it('initializes SHA-256 repositories with the matching object format', async () => {
+ mockExec.mockImplementation((path, args, options) => {
+ if (args.includes('version')) {
+ options.listeners.stdout(Buffer.from('git version 2.50.1'))
+ }
+
+ return 0
+ })
+ jest.spyOn(exec, 'exec').mockImplementation(mockExec)
+
+ git = await commandManager.createCommandManager('test', false, false)
+
+ await git.init('sha256')
+
+ expect(mockExec).toHaveBeenCalledWith(
+ expect.any(String),
+ ['init', '--object-format=sha256', 'test'],
+ expect.any(Object)
+ )
+ })
+
+ it('initializes SHA-1 repositories with existing default arguments', async () => {
+ mockExec.mockImplementation((path, args, options) => {
+ if (args.includes('version')) {
+ options.listeners.stdout(Buffer.from('git version 2.50.1'))
+ }
+
+ return 0
+ })
+ jest.spyOn(exec, 'exec').mockImplementation(mockExec)
+
+ git = await commandManager.createCommandManager('test', false, false)
+
+ await git.init('sha1')
+
+ expect(mockExec).toHaveBeenCalledWith(
+ expect.any(String),
+ ['init', 'test'],
+ expect.any(Object)
+ )
+ })
+})
+
describe('git user-agent with orchestration ID', () => {
beforeEach(async () => {
jest.spyOn(fshelper, 'fileExistsSync').mockImplementation(jest.fn())