Skip to content

Commit

Permalink
fix tests - use config when setting up repo & set creds before creati…
Browse files Browse the repository at this point in the history
…ng default signature

Signed-off-by: Kipras Melnikovas <[email protected]>
  • Loading branch information
kiprasmel committed Jan 23, 2022
1 parent 0f23eeb commit a0139bb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/experiment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ export async function testCase() {

const {
repo, //
config,
sig,
dir,
} = await setupRepo();

const config: Git.Config = await repo.config();

await config.setBool(configKeys.autoApplyIfNeeded, Git.Config.MAP.FALSE);
await config.setString("user.email", "[email protected]");
await config.setString("user.name", "tester");

const commitOidsInInitial: Git.Oid[] = [];
const initialBranch: Git.Reference = await appendCommitsTo(commitOidsInInitial, 3, repo, sig);

Expand Down Expand Up @@ -167,6 +162,12 @@ export async function setupRepo() {
const isBare = 0;
const repo: Git.Repository = await Git.Repository.init(dir, isBare);

const config: Git.Config = await repo.config();

await config.setBool(configKeys.autoApplyIfNeeded, Git.Config.MAP.FALSE);
await config.setString("user.email", "[email protected]");
await config.setString("user.name", "tester");

const sig: Git.Signature = await Git.Signature.default(repo);
log("sig %s", sig);

Expand All @@ -178,6 +179,7 @@ export async function setupRepo() {
return {
dir,
repo,
config,
sig,
initialCommit,
} as const;
Expand Down

0 comments on commit a0139bb

Please sign in to comment.