@@ -453,6 +453,44 @@ export async function getSvnWorkingState(cwd: string): Promise<{
453453 // Diff might not be available
454454 }
455455
456+ // If diff is empty but we have untracked files, provide additional information
457+ if ( ! diff . trim ( ) && status . trim ( ) ) {
458+ const untrackedFiles = status
459+ . split ( "\n" )
460+ . filter ( ( line ) => line . trim ( ) . startsWith ( "?" ) )
461+ . map ( ( line ) => line . trim ( ) . substring ( 1 ) . trim ( ) )
462+
463+ if ( untrackedFiles . length > 0 ) {
464+ console . log ( "[DEBUG] Found untracked files, attempting to show content preview" )
465+ let additionalInfo = "\n\nNote: The following files are untracked (not under version control):\n"
466+
467+ for ( const file of untrackedFiles . slice ( 0 , 3 ) ) {
468+ // Limit to first 3 files
469+ try {
470+ const filePath = path . resolve ( cwd , file )
471+ const stats = await fs . stat ( filePath )
472+
473+ if ( stats . isFile ( ) && stats . size < 10000 ) {
474+ // Only show content for small files
475+ const content = await fs . readFile ( filePath , "utf-8" )
476+ const preview = content . length > 500 ? content . substring ( 0 , 500 ) + "..." : content
477+ additionalInfo += `\n--- Content of ${ file } ---\n${ preview } \n`
478+ } else {
479+ additionalInfo += `\n--- ${ file } (${ stats . isFile ( ) ? "file" : "directory" } ) ---\n`
480+ }
481+ } catch ( error ) {
482+ additionalInfo += `\n--- ${ file } (unable to read: ${ error . message } ) ---\n`
483+ }
484+ }
485+
486+ if ( untrackedFiles . length > 3 ) {
487+ additionalInfo += `\n... and ${ untrackedFiles . length - 3 } more untracked files`
488+ }
489+
490+ diff = additionalInfo
491+ }
492+ }
493+
456494 const result = { status, diff }
457495 console . log ( "[DEBUG] getSvnWorkingState returning:" , JSON . stringify ( result ) )
458496 return result
0 commit comments