-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
export const localGetDiff = () => "" | ||
import * as debug from "debug" | ||
import { exec } from "child_process" | ||
|
||
const d = debug("danger:localGetDiff") | ||
|
||
export const localGetDiff = (base: string, head: string) => | ||
new Promise(done => { | ||
const call = `git diff --no-index ${base} ${head}` | ||
d(call) | ||
|
||
exec(call, (err, stdout, _stderr) => { | ||
if (err) { | ||
console.error(`Could not get diff from git between ${base} and ${head}`) | ||
console.error(err) | ||
return | ||
} | ||
|
||
done(stdout) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
export const localGetFileAtSHA = () => "" | ||
import * as debug from "debug" | ||
import { exec } from "child_process" | ||
|
||
const d = debug("danger:localGetFileAtSHA") | ||
|
||
export const localGetFileAtSHA = (path: string, _repo: string | undefined, sha: string) => | ||
new Promise(done => { | ||
const call = `git show ${sha}:"${path}"` | ||
d(call) | ||
|
||
exec(call, (err, stdout, _stderr) => { | ||
if (err) { | ||
console.error(`Could not get the file ${path} from git at ${sha}`) | ||
console.error(err) | ||
return | ||
} | ||
|
||
done(stdout) | ||
}) | ||
}) |