Skip to content

Commit 9775205

Browse files
committed
Fix unit test failure
Make sure we always set `commitHash` even if it is falsy
1 parent 1de614e commit 9775205

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/vs/platform/telemetry/node/commonProperties.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ import * as os from 'os';
88
import * as uuid from 'vs/base/common/uuid';
99
import { readFile } from 'vs/base/node/pfs';
1010

11-
export function resolveCommonProperties(commit: string | undefined, version: string, machineId: string, installSourcePath: string): Promise<{ [name: string]: string; }> {
12-
const result: { [name: string]: string; } = Object.create(null);
11+
export function resolveCommonProperties(commit: string | undefined, version: string, machineId: string, installSourcePath: string): Promise<{ [name: string]: string | undefined; }> {
12+
const result: { [name: string]: string | undefined; } = Object.create(null);
1313
// __GDPR__COMMON__ "common.machineId" : { "endPoint": "MacAddressHash", "classification": "EndUserPseudonymizedInformation", "purpose": "FeatureInsight" }
1414
result['common.machineId'] = machineId;
1515
// __GDPR__COMMON__ "sessionID" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
1616
result['sessionID'] = uuid.generateUuid() + Date.now();
17-
if (typeof commit === 'string') {
18-
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
19-
result['commitHash'] = commit;
20-
}
17+
// __GDPR__COMMON__ "commitHash" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
18+
result['commitHash'] = commit;
2119
// __GDPR__COMMON__ "version" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
2220
result['version'] = version;
2321
// __GDPR__COMMON__ "common.platformVersion" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }

src/vs/platform/telemetry/node/workbenchCommonProperties.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProper
88

99
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
1010

11-
export function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string, version: string, machineId: string, installSourcePath: string): Promise<{ [name: string]: string }> {
11+
export function resolveWorkbenchCommonProperties(storageService: IStorageService, commit: string, version: string, machineId: string, installSourcePath: string): Promise<{ [name: string]: string | undefined }> {
1212
return resolveCommonProperties(commit, version, machineId, installSourcePath).then(result => {
1313
const instanceId = storageService.get('telemetry.instanceId', StorageScope.GLOBAL)!;
1414
const firstSessionDate = storageService.get('telemetry.firstSessionDate', StorageScope.GLOBAL)!;

0 commit comments

Comments
 (0)