Skip to content

Commit

Permalink
Add detached current branch fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Oct 31, 2024
1 parent 9cac976 commit a74444b
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 7 deletions.
1 change: 1 addition & 0 deletions fixtures/detached/_git/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2dbee47a8d4f8d39e1168fad951b703ee05614d6
13 changes: 13 additions & 0 deletions fixtures/detached/_git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = /scan-git/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
remote = origin
merge = refs/heads/main
Binary file added fixtures/detached/_git/index
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x��M
�0F]��d�L~
".<�x�i:Q�4c�o�7p�x�>�TKyv0&�z�n�K����Ō�4�K�H@ Y�������DG1�(>G�k�G�S���l��6���3\�����M��C��ڻh�&ka�Q�v���Z���a�P?*�H
Expand Down
2 changes: 2 additions & 0 deletions fixtures/detached/_git/objects/info/packs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
P pack-43bc2b9ae5b7a56ab22e849c6c1dfaa00ba72ab1.pack

Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions fixtures/detached/_git/refs/heads/main
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7b84f676f2fbea2a3c6d83924fa63059c7bdfbe2
1 change: 1 addition & 0 deletions fixtures/detached/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
20 changes: 13 additions & 7 deletions test/helpers/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type LazyFixture = {
};

const fixturesPath = '../../fixtures/';
const fixtureNames = ['base', 'cruft', 'no-remotes', 'upstream', 'clean', 'rev-index'];
const fixtureNames = ['base', 'detached', 'cruft', 'no-remotes', 'upstream', 'clean', 'rev-index'];

export const nullRepo: Repo = null as unknown as Repo;
export const fixtures: Record<string, LazyFixture> = Object.create(null);
Expand All @@ -33,11 +33,17 @@ for (const name of fixtureNames) {
fs.promises.readdir = origReaddir;
}
},
data: JSON.parse(
fs.readFileSync(
fileURLToPath(new URL(fixturesPath + name + '/data.json', import.meta.url)),
'utf8'
)
)
get data() {
const value = JSON.parse(
fs.readFileSync(
fileURLToPath(new URL(fixturesPath + name + '/data.json', import.meta.url)),
'utf8'
)
);

Object.defineProperty(this, 'data', { value });

return value;
}
};
}

0 comments on commit a74444b

Please sign in to comment.