Skip to content

Commit

Permalink
chore: apply cr suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
EscapeB committed Feb 27, 2024
1 parent 9fc3cfc commit 02aa23b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
12 changes: 5 additions & 7 deletions apps/sparo-lib/src/cli/commands/checkout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ export class CheckoutCommand implements ICommand<ICheckoutCommandOptions> {
await this._gitSparseCheckoutService.purgeAsync();
} else if (targetProfileNames.size) {
// TODO: policy #1: Can not sparse checkout with uncommitted changes in the cone.
for (const p of profiles) {
for (const profile of profiles) {
// Since we have run localState.reset() before, for each profile we just add it to local state.
const { selections, includeFolders, excludeFolders } =
await this._gitSparseCheckoutService.resolveSparoProfileAsync(p, {
await this._gitSparseCheckoutService.resolveSparoProfileAsync(profile, {
localStateUpdateAction: 'add'
});
// for profiles, we use sparse checkout set
Expand All @@ -187,10 +187,10 @@ export class CheckoutCommand implements ICommand<ICheckoutCommandOptions> {
checkoutAction: 'set'
});
}
for (const p of addProfiles) {
for (const profile of addProfiles) {
// For each add profile we add it to local state.
const { selections, includeFolders, excludeFolders } =
await this._gitSparseCheckoutService.resolveSparoProfileAsync(p, {
await this._gitSparseCheckoutService.resolveSparoProfileAsync(profile, {
localStateUpdateAction: 'add'
});
// for add profiles, we use sparse checkout add
Expand Down Expand Up @@ -287,9 +287,7 @@ export class CheckoutCommand implements ICommand<ICheckoutCommandOptions> {
const addProfiles: Set<string> = new Set(addProfilesFromArg.filter((p) => typeof p === 'string'));

if (isNoProfile && (profiles.size || addProfiles.size)) {
throw new Error(
`The "--no-profile" parameter cannot be combined with "--profile" or "--add-profile"`
);
throw new Error(`The "--no-profile" parameter cannot be combined with "--profile" or "--add-profile"`);
}

return {
Expand Down
2 changes: 1 addition & 1 deletion apps/sparo-lib/src/services/GitSparseCheckoutService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ ${availableProfiles.join(',')}
terminal.writeDebugLine(`Skip sparse checkout regarding no target folders`);
} else {
terminal.writeLine(
`Performing sparse checkout ${checkoutAction} for these folders: ${targetFolders.join(' ')}`
`Performing sparse checkout ${checkoutAction} for these folders: \n${targetFolders.join('\n ')}`
);
this._sparseCheckoutPaths(targetFolders, {
action: checkoutAction
Expand Down

This file was deleted.

0 comments on commit 02aa23b

Please sign in to comment.