Skip to content

Commit

Permalink
fix: Identical hash commits should skip comparison (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
diervo authored Jan 7, 2018
1 parent 0197fa7 commit 38f1911
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/best-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ export async function runCLI(argsCLI, projects) {

if (globalConfig.compareStats) {
results = await runCompare(globalConfig, configs, outputStream);
generateComparisonTable(results, outputStream);
if (results) {
generateComparisonTable(results, outputStream);
}

} else {
if (argsCLI.clearResults) {
Expand Down
8 changes: 7 additions & 1 deletion packages/best-cli/src/run_compare.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { preRunMessager } from "@best/messager";
import { compareBenchmarkStats } from "@best/compare";
import { pushBenchmarkComparison } from "@best/github-integration";
import { basename } from "path";

export async function runCompare(globalConfig, configs, outputStream) {
const { gitIntegration, externalStorage, compareStats: commits } = globalConfig;
const [baseCommit, compareCommit] = commits;

if (configs.length > 1) {
throw new Error('WIP - Do not support multiple projects for compare just yet...');
Expand All @@ -17,8 +19,12 @@ export async function runCompare(globalConfig, configs, outputStream) {
throw new Error('Wrong number of commmits to compare we are expectine one or two');
}

if (baseCommit === compareCommit) {
console.log(`Hash of commits are identical (${baseCommit}). Skipping comparison`);
return false;
}

const projectConfig = configs[0];
const [baseCommit, compareCommit] = commits;
const { projectName } = projectConfig;
let storageProvider;
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/best-config/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function setFromArgs(initialOptions, argsCLI) {
}
return options;
}, {});
console.log(argvToOptions);

return Object.assign({}, initialOptions, argvToOptions);
}

Expand Down

0 comments on commit 38f1911

Please sign in to comment.