Skip to content

Commit ae15cb6

Browse files
fix(bin): case sensitivity in file path handling for git operations (#75)
* fix: preserve original file path case for git show in diff-changes `git show` on Linux is case-sensitive, so passing a lowercased path (e.g. `input_schema.json`) fails when the actual file in git is `INPUT_SCHEMA.json`. This fix keeps both the lowercased path (for actor name matching and `.endsWith()` checks) and the original case-preserved path (for the `git show` call in `isCosmeticOnlyJsonSchemaChange`). https://claude.ai/code/session_01NHgddik3UA7sDUi12hBUud * refactor: move toLowerCase into classifyFileChange Callers no longer need to pre-compute lowercaseFilePath; the function owns the case-folding for matching while still using the original path for git show. https://claude.ai/code/session_01NHgddik3UA7sDUi12hBUud * docs: comment that isCosmeticOnlyJsonSchemaChange requires case-sensitive path https://claude.ai/code/session_01NHgddik3UA7sDUi12hBUud --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7ce374c commit ae15cb6

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

bin/diff-changes.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ type FileChange =
5151
includes: 'all-actors' | ActorConfig;
5252
};
5353

54-
const classifyFileChange = (lowercaseFilePath: string, actorConfigs: ActorConfig[], commits: Commit[]): FileChange => {
54+
const classifyFileChange = (originalFilePath: string, actorConfigs: ActorConfig[], commits: Commit[]): FileChange => {
55+
// Lowercase for case-insensitive matching; keep original for git show (case-sensitive on Linux)
56+
const lowercaseFilePath = originalFilePath.toLowerCase();
5557
if (isIgnoredTopLevelFile(lowercaseFilePath)) {
5658
return { impact: 'ignored' };
5759
}
@@ -79,7 +81,8 @@ const classifyFileChange = (lowercaseFilePath: string, actorConfigs: ActorConfig
7981
if (lowercaseFilePath.endsWith('readme.md')) {
8082
return { impact: 'cosmetic', includes: actorConfigChanged };
8183
}
82-
if (lowercaseFilePath.endsWith('.json') && isCosmeticOnlyJsonSchemaChange(commits, lowercaseFilePath)) {
84+
// originalFilePath must be used here (not lowercaseFilePath) — git show is case-sensitive on Linux
85+
if (lowercaseFilePath.endsWith('.json') && isCosmeticOnlyJsonSchemaChange(commits, originalFilePath)) {
8386
return { impact: 'cosmetic', includes: actorConfigChanged };
8487
}
8588

@@ -101,10 +104,8 @@ export const getChangedActors = ({
101104

102105
const actorConfigsWithoutStandalone = actorConfigs.filter(({ isStandalone }) => !isStandalone);
103106

104-
const lowercaseFiles = filepathsChanged.map((file) => file.toLowerCase());
105-
106-
for (const lowercaseFilePath of lowercaseFiles) {
107-
const fileChange = classifyFileChange(lowercaseFilePath, actorConfigs, commits);
107+
for (const originalFilePath of filepathsChanged) {
108+
const fileChange = classifyFileChange(originalFilePath, actorConfigs, commits);
108109
if (fileChange.impact === 'ignored') {
109110
continue;
110111
}
@@ -126,17 +127,17 @@ export const getChangedActors = ({
126127
const actorsChanged = Array.from(actorsChangedMap.values());
127128

128129
// All below here is just for logging
129-
const ignoredFilesChanged = lowercaseFiles.filter(
130+
const ignoredFilesChanged = filepathsChanged.filter(
130131
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'ignored',
131132
);
132133
console.error(`[DIFF]: Ignored files (don't trigger test or build): ${ignoredFilesChanged.join(', ')}`);
133134

134-
const cosmeticFilesChanged = lowercaseFiles.filter(
135+
const cosmeticFilesChanged = filepathsChanged.filter(
135136
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'cosmetic',
136137
);
137138
console.error(`[DIFF]: Cosmetic files (should only trigger release build): ${cosmeticFilesChanged.join(', ')}`);
138139

139-
const functionalFilesChanged = lowercaseFiles.filter(
140+
const functionalFilesChanged = filepathsChanged.filter(
140141
(file) => classifyFileChange(file, actorConfigs, commits).impact === 'functional',
141142
);
142143
console.error(`[DIFF]: Functional files (trigger test & release build): ${functionalFilesChanged.join(', ')}`);

0 commit comments

Comments
 (0)