fix(core): properly diff json from the merge-base (#15476)
This commit is contained in:
parent
7d25c69579
commit
ffac350e27
@ -166,6 +166,10 @@ export function splitArgsIntoNxArgsAndOverrides(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nxArgs.base) {
|
||||||
|
nxArgs.base = getMergeBase(nxArgs.base, nxArgs.head);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nxArgs.skipNxCache) {
|
if (!nxArgs.skipNxCache) {
|
||||||
@ -231,25 +235,33 @@ function getUntrackedFiles(): string[] {
|
|||||||
return parseGitOutput(`git ls-files --others --exclude-standard`);
|
return parseGitOutput(`git ls-files --others --exclude-standard`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilesUsingBaseAndHead(base: string, head: string): string[] {
|
function getMergeBase(base: string, head: string = 'HEAD') {
|
||||||
let mergeBase: string;
|
|
||||||
try {
|
try {
|
||||||
mergeBase = execSync(`git merge-base "${base}" "${head}"`, {
|
return execSync(`git merge-base "${base}" "${head}"`, {
|
||||||
maxBuffer: TEN_MEGABYTES,
|
maxBuffer: TEN_MEGABYTES,
|
||||||
cwd: workspaceRoot,
|
cwd: workspaceRoot,
|
||||||
|
stdio: 'pipe',
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
} catch {
|
} catch {
|
||||||
mergeBase = execSync(`git merge-base --fork-point "${base}" "${head}"`, {
|
try {
|
||||||
|
return execSync(`git merge-base --fork-point "${base}" "${head}"`, {
|
||||||
maxBuffer: TEN_MEGABYTES,
|
maxBuffer: TEN_MEGABYTES,
|
||||||
cwd: workspaceRoot,
|
cwd: workspaceRoot,
|
||||||
|
stdio: 'pipe',
|
||||||
})
|
})
|
||||||
.toString()
|
.toString()
|
||||||
.trim();
|
.trim();
|
||||||
|
} catch {
|
||||||
|
return base;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFilesUsingBaseAndHead(base: string, head: string): string[] {
|
||||||
return parseGitOutput(
|
return parseGitOutput(
|
||||||
`git diff --name-only --no-renames --relative "${mergeBase}" "${head}"`
|
`git diff --name-only --no-renames --relative "${base}" "${head}"`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user