feat: setup git configurations when full clone

This commit is contained in:
Cheng Liu 2024-07-11 14:19:06 -07:00
parent 6ab94084ff
commit d445a4dce4
No known key found for this signature in database
GPG key ID: EEC8452F7DB85CD6

View file

@ -77,15 +77,16 @@ export class CloneCommand implements ICommand<ICloneCommandOptions> {
directory: directory
};
const { full, skipGitConfig } = args;
terminal.writeLine('Initializing working directory...');
const stopwatch: Stopwatch = Stopwatch.start();
if (args.full) {
if (full) {
this._gitCloneService.fullClone(cloneOptions);
return;
}
} else {
this._gitCloneService.bloblessClone(cloneOptions);
}
process.chdir(directory);
@ -94,7 +95,8 @@ export class CloneCommand implements ICommand<ICloneCommandOptions> {
addProfilesFromArg: []
});
await this._GitSparseCheckoutService.ensureSkeletonExistAndUpdated();
if (!full) {
this._GitSparseCheckoutService.ensureSkeletonExistAndUpdated();
// check whether profile exist in local branch
if (!isNoProfile) {
@ -122,9 +124,10 @@ export class CloneCommand implements ICommand<ICloneCommandOptions> {
profiles: isNoProfile ? undefined : profiles
});
}
}
// set recommended git config
if (!args.skipGitConfig) {
if (!skipGitConfig) {
terminal.writeLine(`Applying recommended configuration...`);
this._gitService.setRecommendConfig({ overwrite: true });
}
@ -139,7 +142,7 @@ export class CloneCommand implements ICommand<ICloneCommandOptions> {
terminal.writeLine(' ' + Colorize.cyan(`cd ${directory}`));
terminal.writeLine();
if (isNoProfile || profiles.size === 0) {
if (!full && (isNoProfile || profiles.size === 0)) {
terminal.writeLine('Your next step is to choose a Sparo profile for checkout.');
terminal.writeLine('To see available profiles in this repo:');
terminal.writeLine(' ' + Colorize.cyan('sparo list-profiles'));