Skip to content

Commit

Permalink
Use --force-overwrite for creating databases
Browse files Browse the repository at this point in the history
...but only if the feature exists in the CLI.
  • Loading branch information
Andrew Eisenberg committed Jun 11, 2024
1 parent c796494 commit 0a64ae0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/codeql.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/codeql.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/tools-features.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/tools-features.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion src/codeql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,17 @@ export async function getCodeQLForCmd(
extraArgs.push("--no-sublanguage-file-coverage");
}

const overwriteFlag = isSupportedToolsFeature(
await this.getVersion(),
ToolsFeature.ForceOverwite,
) ? "--force-overwrite" : "--overwrite";

await runTool(
cmd,
[
"database",
"init",
"--overwrite",
overwriteFlag,
"--db-cluster",
config.dbLocation,
`--source-root=${sourceRoot}`,
Expand Down
1 change: 1 addition & 0 deletions src/tools-features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export enum ToolsFeature {
SetsCodeqlRunnerEnvVar = "setsCodeqlRunnerEnvVar",
TraceCommandUseBuildMode = "traceCommandUseBuildMode",
SarifMergeRunsFromEqualCategory = "sarifMergeRunsFromEqualCategory",
ForceOverwite = "forceOverwite",
}

/**
Expand Down

0 comments on commit 0a64ae0

Please sign in to comment.