Skip to content

Commit

Permalink
style(git): format code for consistency and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
alanjaouen committed Dec 27, 2024
1 parent e1614dc commit 8c0b04e
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/core/git/Git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Git {
return this._git.revparse(['HEAD']);

Check warning on line 31 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L30-L31

Added lines #L30 - L31 were not covered by tests
}

async getBaseBranchCommit(baseBranch:string): Promise<string> {
async getBaseBranchCommit(baseBranch: string): Promise<string> {
return this._git.revparse([baseBranch]);

Check warning on line 35 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L34-L35

Added lines #L34 - L35 were not covered by tests
}

Expand Down Expand Up @@ -149,7 +149,7 @@ export default class Git {
filter: (src) => {
const relativePath = path.relative(process.cwd(), src);

Check warning on line 150 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L148-L150

Added lines #L148 - L150 were not covered by tests
return !relativePath || !gitignore.ignores(relativePath);
}
},
});

//Initiate git on new repo on using the abstracted object
Expand Down Expand Up @@ -187,7 +187,7 @@ export default class Git {

public raw(commands: string[]) {
return this._git.raw(commands);

Check warning on line 189 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L188-L189

Added lines #L188 - L189 were not covered by tests
}
}

public getRepositoryPath() {
return this.repositoryLocation;

Check warning on line 193 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L192-L193

Added lines #L192 - L193 were not covered by tests
Expand All @@ -198,14 +198,12 @@ export default class Git {
}

async addSafeConfig(repoDir: string) {
try
{
//add workaround for safe directory (https://github.com/actions/runner/issues/2033)
await this._git.addConfig('safe.directory', repoDir, false, 'global');
}catch(error)
{
try {

Check warning on line 201 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L200-L201

Added lines #L200 - L201 were not covered by tests
//add workaround for safe directory (https://github.com/actions/runner/issues/2033)
await this._git.addConfig('safe.directory', repoDir, false, 'global');

Check warning on line 203 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L203

Added line #L203 was not covered by tests
} catch (error) {
//ignore error
SFPLogger.log(`Unable to set safe.directory`,LoggerLevel.TRACE)
SFPLogger.log(`Unable to set safe.directory`, LoggerLevel.TRACE);

Check warning on line 206 in src/core/git/Git.ts

View check run for this annotation

Codecov / codecov/patch

src/core/git/Git.ts#L206

Added line #L206 was not covered by tests
}
}

Expand Down

0 comments on commit 8c0b04e

Please sign in to comment.