Skip to content

Commit

Permalink
fix(git): add directories (#11643)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Sep 8, 2021
1 parent 11577d6 commit 496c2d0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/util/git/index.ts
Expand Up @@ -740,18 +740,20 @@ export async function commitFiles({
logger.trace({ err, fileName }, 'Cannot delete file');
ignoredFiles.push(fileName);
}
} else if (await isDirectory(join(localDir, fileName))) {
logger.warn({ fileName }, 'Skipping directory commit');
ignoredFiles.push(fileName);
} else {
let contents: Buffer;
// istanbul ignore else
if (typeof file.contents === 'string') {
contents = Buffer.from(file.contents);
if (await isDirectory(join(localDir, fileName))) {
// This is usually a git submodule update
logger.trace({ fileName }, 'Adding directory commit');
} else {
contents = file.contents;
let contents: Buffer;
// istanbul ignore else
if (typeof file.contents === 'string') {
contents = Buffer.from(file.contents);
} else {
contents = file.contents;
}
await fs.outputFile(join(localDir, fileName), contents);
}
await fs.outputFile(join(localDir, fileName), contents);
try {
await git.add(fileName);
addedModifiedFiles.push(fileName);
Expand Down

0 comments on commit 496c2d0

Please sign in to comment.