Skip to content

Commit

Permalink
fix: path normalizing from iso-git
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Sep 16, 2021
1 parent 78ac398 commit b8cddaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 1 addition & 7 deletions src/commands/force/source/beta/status.ts
Expand Up @@ -6,9 +6,8 @@
*/

import * as os from 'os';
import { normalize } from 'path';
import { FlagsConfig, flags, SfdxCommand } from '@salesforce/command';
import { SfdxProject, Org, Messages, OrgUsersConfig } from '@salesforce/core';
import { SfdxProject, Org, Messages } from '@salesforce/core';

import { ChangeResult, SourceTracking, getKeyFromObject, getKeyFromStrings } from '../../../../sourceTracking';
import { throwIfInvalid, replaceRenamedCommands } from '../../../../compatibility';
Expand Down Expand Up @@ -121,11 +120,6 @@ export default class SourceStatus extends SfdxCommand {
}
}

// normalize paths in case of windows
if (os.type() === 'Windows_NT') {
outputRows = outputRows.map((row) => ({ ...row, filePath: row.filePath ? normalize(row.filePath) : undefined }));
}

// sort order is state, type, fullname
outputRows.sort((a, b) => {
if (a.state.toLowerCase() === b.state.toLowerCase()) {
Expand Down
8 changes: 6 additions & 2 deletions src/shared/localShadowRepo.ts
Expand Up @@ -6,7 +6,8 @@
*/
/* eslint-disable no-console */

import { join as pathJoin } from 'path';
import { join as pathJoin, normalize } from 'path';
import * as os from 'os';
import * as fs from 'fs';
import { AsyncCreatable } from '@salesforce/kit';
import { NamedPackageDir, Logger } from '@salesforce/core';
Expand All @@ -19,7 +20,10 @@ const getGitDir = (orgId: string, projectPath: string): string => {
return pathJoin(projectPath, '.sfdx', 'orgs', orgId, 'localSourceTracking');
};

const toFilenames = (rows: StatusRow[]): string[] => rows.map((file) => file[FILE] as string);
const toFilenames = (rows: StatusRow[]): string[] =>
os.type() === 'Windows_NT'
? rows.map((file) => normalize(file[FILE] as string))
: rows.map((file) => file[FILE] as string);

interface ShadowRepoOptions {
orgId: string;
Expand Down

0 comments on commit b8cddaf

Please sign in to comment.