File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/cli-plugins/ai-index/src/utils/git Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ export const getChangedFiles = async (options: GitDiffOptions): Promise<ChangedF
3636 // Match status and file path
3737 // Format: "A\tfile.ts" or "M\tfile.ts" or "D\tfile.ts"
3838 // Also handle renames: "R100\told.ts\tnew.ts"
39+ const renameMatch = line . match ( / ^ R \d * \s + ( .+ ?) \s + ( .+ ) $ / ) ;
40+ if ( renameMatch ) {
41+ const [ , oldFile , newFile ] = renameMatch ;
42+ // Add both the removed old file and the new file
43+ changedFiles . push ( { filepath : `${ projectRoot } /${ oldFile } ` , status : 'removed' } ) ;
44+ changedFiles . push ( { filepath : `${ projectRoot } /${ newFile } ` , status : 'new' } ) ;
45+ continue ;
46+ }
47+
3948 const match = line . match ( / ^ ( [ A M D ] ) \s + ( .+ ) $ / ) ;
4049 if ( match ) {
4150 const [ , gitStatus , file ] = match ;
@@ -49,7 +58,7 @@ export const getChangedFiles = async (options: GitDiffOptions): Promise<ChangedF
4958 } else if ( gitStatus === 'D' ) {
5059 status = 'removed' ;
5160 } else {
52- // Skip unknown statuses (R=renamed, C=copied, etc.)
61+ // Skip unknown statuses (C=copied, etc.)
5362 continue ;
5463 }
5564
You can’t perform that action at this time.
0 commit comments