fix: error getting diff for submodules (#1473)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
52dbf3e3cf
commit
17f3fec1ed
29
dist/index.js
generated
vendored
29
dist/index.js
generated
vendored
@ -75,11 +75,20 @@ const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, s
|
|||||||
});
|
});
|
||||||
const submoduleWorkingDirectory = path.join(workingDirectory, submodulePath);
|
const submoduleWorkingDirectory = path.join(workingDirectory, submodulePath);
|
||||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||||
|
let diff = '...';
|
||||||
|
if (!(yield (0, utils_1.canDiffCommits)({
|
||||||
|
cwd: submoduleWorkingDirectory,
|
||||||
|
sha1: submoduleShaResult.previousSha,
|
||||||
|
sha2: submoduleShaResult.currentSha,
|
||||||
|
diff
|
||||||
|
}))) {
|
||||||
|
diff = '..';
|
||||||
|
}
|
||||||
const submoduleRenamedFiles = yield (0, utils_1.gitRenamedFiles)({
|
const submoduleRenamedFiles = yield (0, utils_1.gitRenamedFiles)({
|
||||||
cwd: submoduleWorkingDirectory,
|
cwd: submoduleWorkingDirectory,
|
||||||
sha1: submoduleShaResult.previousSha,
|
sha1: submoduleShaResult.previousSha,
|
||||||
sha2: submoduleShaResult.currentSha,
|
sha2: submoduleShaResult.currentSha,
|
||||||
diff: diffResult.diff,
|
diff,
|
||||||
oldNewSeparator: inputs.oldNewSeparator,
|
oldNewSeparator: inputs.oldNewSeparator,
|
||||||
isSubmodule: true,
|
isSubmodule: true,
|
||||||
parentDir: submodulePath
|
parentDir: submodulePath
|
||||||
@ -130,11 +139,20 @@ const getAllDiffFiles = ({ workingDirectory, hasSubmodule, diffResult, submodule
|
|||||||
});
|
});
|
||||||
const submoduleWorkingDirectory = path.join(workingDirectory, submodulePath);
|
const submoduleWorkingDirectory = path.join(workingDirectory, submodulePath);
|
||||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||||
|
let diff = '...';
|
||||||
|
if (!(yield (0, utils_1.canDiffCommits)({
|
||||||
|
cwd: submoduleWorkingDirectory,
|
||||||
|
sha1: submoduleShaResult.previousSha,
|
||||||
|
sha2: submoduleShaResult.currentSha,
|
||||||
|
diff
|
||||||
|
}))) {
|
||||||
|
diff = '..';
|
||||||
|
}
|
||||||
const submoduleFiles = yield (0, utils_1.getAllChangedFiles)({
|
const submoduleFiles = yield (0, utils_1.getAllChangedFiles)({
|
||||||
cwd: submoduleWorkingDirectory,
|
cwd: submoduleWorkingDirectory,
|
||||||
sha1: submoduleShaResult.previousSha,
|
sha1: submoduleShaResult.previousSha,
|
||||||
sha2: submoduleShaResult.currentSha,
|
sha2: submoduleShaResult.currentSha,
|
||||||
diff: diffResult.diff,
|
diff,
|
||||||
isSubmodule: true,
|
isSubmodule: true,
|
||||||
parentDir: submodulePath,
|
parentDir: submodulePath,
|
||||||
outputRenamedFilesAsDeletedAndAdded
|
outputRenamedFilesAsDeletedAndAdded
|
||||||
@ -1572,19 +1590,12 @@ function run() {
|
|||||||
'baseSha',
|
'baseSha',
|
||||||
'since',
|
'since',
|
||||||
'until',
|
'until',
|
||||||
'path',
|
|
||||||
'quotePath',
|
|
||||||
'diffRelative',
|
|
||||||
'sinceLastRemoteCommit',
|
'sinceLastRemoteCommit',
|
||||||
'recoverDeletedFiles',
|
'recoverDeletedFiles',
|
||||||
'recoverDeletedFilesToDestination',
|
'recoverDeletedFilesToDestination',
|
||||||
'recoverFiles',
|
'recoverFiles',
|
||||||
'recoverFilesSeparator',
|
|
||||||
'recoverFilesIgnore',
|
'recoverFilesIgnore',
|
||||||
'recoverFilesIgnoreSeparator',
|
|
||||||
'includeAllOldNewRenamedFiles',
|
'includeAllOldNewRenamedFiles',
|
||||||
'oldNewSeparator',
|
|
||||||
'oldNewFilesSeparator',
|
|
||||||
'skipInitialFetch'
|
'skipInitialFetch'
|
||||||
];
|
];
|
||||||
for (const input of unsupportedInputs) {
|
for (const input of unsupportedInputs) {
|
||||||
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -8,6 +8,7 @@ import * as path from 'path'
|
|||||||
import {DiffResult} from './commitSha'
|
import {DiffResult} from './commitSha'
|
||||||
import {Inputs} from './inputs'
|
import {Inputs} from './inputs'
|
||||||
import {
|
import {
|
||||||
|
canDiffCommits,
|
||||||
getAllChangedFiles,
|
getAllChangedFiles,
|
||||||
getDirnameMaxDepth,
|
getDirnameMaxDepth,
|
||||||
getDirNamesIncludeFilesPattern,
|
getDirNamesIncludeFilesPattern,
|
||||||
@ -54,11 +55,24 @@ export const getRenamedFiles = async ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||||
|
let diff = '...'
|
||||||
|
|
||||||
|
if (
|
||||||
|
!(await canDiffCommits({
|
||||||
|
cwd: submoduleWorkingDirectory,
|
||||||
|
sha1: submoduleShaResult.previousSha,
|
||||||
|
sha2: submoduleShaResult.currentSha,
|
||||||
|
diff
|
||||||
|
}))
|
||||||
|
) {
|
||||||
|
diff = '..'
|
||||||
|
}
|
||||||
|
|
||||||
const submoduleRenamedFiles = await gitRenamedFiles({
|
const submoduleRenamedFiles = await gitRenamedFiles({
|
||||||
cwd: submoduleWorkingDirectory,
|
cwd: submoduleWorkingDirectory,
|
||||||
sha1: submoduleShaResult.previousSha,
|
sha1: submoduleShaResult.previousSha,
|
||||||
sha2: submoduleShaResult.currentSha,
|
sha2: submoduleShaResult.currentSha,
|
||||||
diff: diffResult.diff,
|
diff,
|
||||||
oldNewSeparator: inputs.oldNewSeparator,
|
oldNewSeparator: inputs.oldNewSeparator,
|
||||||
isSubmodule: true,
|
isSubmodule: true,
|
||||||
parentDir: submodulePath
|
parentDir: submodulePath
|
||||||
@ -133,11 +147,24 @@ export const getAllDiffFiles = async ({
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||||
|
let diff = '...'
|
||||||
|
|
||||||
|
if (
|
||||||
|
!(await canDiffCommits({
|
||||||
|
cwd: submoduleWorkingDirectory,
|
||||||
|
sha1: submoduleShaResult.previousSha,
|
||||||
|
sha2: submoduleShaResult.currentSha,
|
||||||
|
diff
|
||||||
|
}))
|
||||||
|
) {
|
||||||
|
diff = '..'
|
||||||
|
}
|
||||||
|
|
||||||
const submoduleFiles = await getAllChangedFiles({
|
const submoduleFiles = await getAllChangedFiles({
|
||||||
cwd: submoduleWorkingDirectory,
|
cwd: submoduleWorkingDirectory,
|
||||||
sha1: submoduleShaResult.previousSha,
|
sha1: submoduleShaResult.previousSha,
|
||||||
sha2: submoduleShaResult.currentSha,
|
sha2: submoduleShaResult.currentSha,
|
||||||
diff: diffResult.diff,
|
diff,
|
||||||
isSubmodule: true,
|
isSubmodule: true,
|
||||||
parentDir: submodulePath,
|
parentDir: submodulePath,
|
||||||
outputRenamedFilesAsDeletedAndAdded
|
outputRenamedFilesAsDeletedAndAdded
|
||||||
|
@ -311,19 +311,12 @@ export async function run(): Promise<void> {
|
|||||||
'baseSha',
|
'baseSha',
|
||||||
'since',
|
'since',
|
||||||
'until',
|
'until',
|
||||||
'path',
|
|
||||||
'quotePath',
|
|
||||||
'diffRelative',
|
|
||||||
'sinceLastRemoteCommit',
|
'sinceLastRemoteCommit',
|
||||||
'recoverDeletedFiles',
|
'recoverDeletedFiles',
|
||||||
'recoverDeletedFilesToDestination',
|
'recoverDeletedFilesToDestination',
|
||||||
'recoverFiles',
|
'recoverFiles',
|
||||||
'recoverFilesSeparator',
|
|
||||||
'recoverFilesIgnore',
|
'recoverFilesIgnore',
|
||||||
'recoverFilesIgnoreSeparator',
|
|
||||||
'includeAllOldNewRenamedFiles',
|
'includeAllOldNewRenamedFiles',
|
||||||
'oldNewSeparator',
|
|
||||||
'oldNewFilesSeparator',
|
|
||||||
'skipInitialFetch'
|
'skipInitialFetch'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user