Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
orta authored Aug 22, 2022
2 parents 36a7146 + 840ecd6 commit 180b18b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/platforms/git/localGetDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { debug } from "../../debug"
import { spawn } from "child_process"

const d = debug("localGetDiff")
const useCommittedDiffArgs = (base: string, head: string) => ["diff", `${base}...${head}`]
const useStagingChanges = () => ["diff", "--staged"]
const useCommittedDiffArgs = (base: string, head: string) => ["diff", "--src-prefix='a/' --dst-prefix='b/'", `${base}...${head}`]
const useStagingChanges = (base: string) => ["diff", "--src-prefix='a/' --dst-prefix='b/'", "--staged"]

export const localGetDiff = (base: string, head: string, staging: boolean = false) =>
new Promise<string>((done) => {
const args = staging ? useStagingChanges() : useCommittedDiffArgs(base, head)
Expand Down

0 comments on commit 180b18b

Please sign in to comment.