Skip to content

Commit

Permalink
fix(git): remove wrong submodule file filter (#16848)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Jul 29, 2022
1 parent 31390db commit 2c5fd14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/util/git/index.spec.ts
Expand Up @@ -208,7 +208,8 @@ describe('util/git/index', () => {
it('should exclude submodules', async () => {
const repo = Git(base.path);
await repo.submoduleAdd(base.path, 'submodule');
await repo.commit('Add submodule');
await repo.submoduleAdd(base.path, 'file');
await repo.commit('Add submodules');
await git.initRepo({
cloneSubmodules: true,
url: base.path,
Expand Down
7 changes: 2 additions & 5 deletions lib/util/git/index.ts
Expand Up @@ -529,7 +529,6 @@ export async function checkoutBranch(branchName: string): Promise<CommitSha> {
export async function getFileList(): Promise<string[]> {
await syncGit();
const branch = config.currentBranch;
const submodules = await getSubmodules();
let files: string;
try {
files = await git.raw(['ls-tree', '-r', branch]);
Expand All @@ -547,14 +546,12 @@ export async function getFileList(): Promise<string[]> {
if (!files) {
return [];
}
// submodules are starting with `160000 commit`
return files
.split(newlineRegex)
.filter(is.string)
.filter((line) => line.startsWith('100'))
.map((line) => line.split(regEx(/\t/)).pop()!)
.filter((file) =>
submodules.every((submodule: string) => !file.startsWith(submodule))
);
.map((line) => line.split(regEx(/\t/)).pop()!);
}

export function getBranchList(): string[] {
Expand Down

0 comments on commit 2c5fd14

Please sign in to comment.