From 85597dc887f9e3076648a9beddecd90168ef8ef7 Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Fri, 21 Feb 2025 13:22:22 -0800 Subject: [PATCH 1/2] [eas-cli] fix git diff header in fingerprint:compare --- packages/eas-cli/src/utils/fingerprintDiff.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/eas-cli/src/utils/fingerprintDiff.ts b/packages/eas-cli/src/utils/fingerprintDiff.ts index 87a2cac42c..d1e7fc83b7 100644 --- a/packages/eas-cli/src/utils/fingerprintDiff.ts +++ b/packages/eas-cli/src/utils/fingerprintDiff.ts @@ -52,8 +52,13 @@ export function abridgedDiff(str1: string, str2: string, contextLines: number = const flushChunk = (): void => { if (currentChunk.length > 0) { - const originalRange = `${startOriginal},${removedLines || 0}`; - const modifiedRange = `${startModified},${addedLines || 0}`; + const contextLines = currentChunkPriorContext.length + currentChunkAfterContext.length; + const originalRange = `${(startOriginal ?? 1) - currentChunkPriorContext.length},${ + contextLines + removedLines + }`; + const modifiedRange = `${(startModified ?? 1) - currentChunkPriorContext.length},${ + contextLines + addedLines + }`; // `git diff` style header output.push(chalk.cyan(`@@ -${originalRange} +${modifiedRange} @@`)); output.push(...currentChunkPriorContext); From 0d74622cac07029e42c1576ced6ab4795283bdf4 Mon Sep 17 00:00:00 2001 From: Quinlan Jung Date: Mon, 24 Feb 2025 12:01:45 -0800 Subject: [PATCH 2/2] Temporary Commit at 2/24/2025, 12:01:45 PM --- CHANGELOG.md | 1 + packages/eas-cli/src/utils/__tests__/fingerprintDiff-test.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1264bbb49..23cf6872ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This is the log of notable changes to EAS CLI and related packages. - Fix `eas fingerprint:compare` URL generation and pretty prints. ([#2909](https://github.com/expo/eas-cli/pull/2909) by [@quinlanj](https://github.com/quinlanj)) - fix formatFields to handle empty array. ([#2914](https://github.com/expo/eas-cli/pull/2914) by [@quinlanj](https://github.com/quinlanj)) +- fix git diff header in `fingerprint:compare`. ([#2915](https://github.com/expo/eas-cli/pull/2915) by [@quinlanj](https://github.com/quinlanj)) ## [15.0.12](https://github.com/expo/eas-cli/releases/tag/v15.0.12) - 2025-02-22 diff --git a/packages/eas-cli/src/utils/__tests__/fingerprintDiff-test.ts b/packages/eas-cli/src/utils/__tests__/fingerprintDiff-test.ts index 201a25dbc7..33e26760d6 100644 --- a/packages/eas-cli/src/utils/__tests__/fingerprintDiff-test.ts +++ b/packages/eas-cli/src/utils/__tests__/fingerprintDiff-test.ts @@ -22,7 +22,7 @@ describe('abridgedDiff', () => { abridgedDiff(str1, str2, 1); const expectedOutput = [ - 'cyan(@@ -2,1 +2,1 @@)', + 'cyan(@@ -1,3 +1,3 @@)', ' gray(Line1)', 'red(-Line2)', 'green(+LineX)', @@ -106,7 +106,7 @@ describe('abridgedDiff', () => { abridgedDiff(str1, str2, 1); const expectedOutput = [ - 'cyan(@@ -3,1 +3,1 @@)', + 'cyan(@@ -2,3 +2,3 @@)', ' gray(Line1)', 'red(-Line2)', 'green(+LineX)',