Skip to content

Commit

Permalink
Rename the to
Browse files Browse the repository at this point in the history
  • Loading branch information
Soyn committed Feb 18, 2020
1 parent 08be748 commit c99655a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/commands/danger-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ setSharedArgs(program).parse(process.argv)
const app = (program as any) as App
const base = app.base || "master"

const localPlatform = new LocalGit({ base, staged: app.staging })
const localPlatform = new LocalGit({ base, staging: app.staging })
localPlatform.validateThereAreChanges().then(changes => {
if (changes) {
const fakeSource = new FakeCI(process.env)
Expand Down
2 changes: 1 addition & 1 deletion source/dsl/cli-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface CliArgs {
/** So you can have many danger runs in one code review */
id: string
/** Use staged changes */
staged?: boolean
staging?: boolean
}

// NOTE: if add something new here, you need to change dslGenerator.ts
4 changes: 2 additions & 2 deletions source/platforms/LocalGit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { readFileSync } from "fs"

export interface LocalGitOptions {
base?: string
staged?: boolean
staging?: boolean
}

export class LocalGit implements Platform {
Expand All @@ -28,7 +28,7 @@ export class LocalGit implements Platform {
const base = this.options.base || "master"
const head = "HEAD"

this.gitDiff = await localGetDiff(base, head, this.options.staged)
this.gitDiff = await localGetDiff(base, head, this.options.staging)
return this.gitDiff
}

Expand Down
6 changes: 3 additions & 3 deletions source/platforms/git/localGetDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { spawn } from "child_process"

const d = debug("localGetDiff")
const useCommittedDiffArgs = (base: string, head: string) => ["diff", `${base}...${head}`]
const useStagedChanges = (base: string) => ["diff", base]
export const localGetDiff = (base: string, head: string, staged: boolean = false) =>
const useStagingChanges = (base: string) => ["diff", base]
export const localGetDiff = (base: string, head: string, staging: boolean = false) =>
new Promise<string>(done => {
const args = staged ? useStagedChanges(base) : useCommittedDiffArgs(base, head)
const args = staging ? useStagingChanges(base) : useCommittedDiffArgs(base, head)
let stdout = ""

const child = spawn("git", args, { env: process.env })
Expand Down
2 changes: 1 addition & 1 deletion source/runner/_tests/jsonToDSL.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe("runner/jsonToDSL", () => {
it("should call LocalGit with correct base", async () => {
await jsonToDSL(dsl as DangerDSLJSONType, new FakeCI({}))
expect(localGetDiff).toHaveBeenLastCalledWith("develop", "HEAD", undefined)
dsl.settings.cliArgs.staged = true
dsl.settings.cliArgs.staging = true
await jsonToDSL(dsl as DangerDSLJSONType, new FakeCI({}))
expect(localGetDiff).toHaveBeenLastCalledWith("develop", "HEAD", true)
})
Expand Down

0 comments on commit c99655a

Please sign in to comment.