From 23d577144cbfc2d4396468c8f17733d52b9423b9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 04:57:41 +0000 Subject: [PATCH] refactor: skip redundant sibling path computation when targetRaw has no backslashes Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/5236f2b8-72a0-476d-bf39-cca041781014 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> --- .../src/core/ingestion/languages/c/import-target.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gitnexus/src/core/ingestion/languages/c/import-target.ts b/gitnexus/src/core/ingestion/languages/c/import-target.ts index 4af025334..0cb9c2fb4 100644 --- a/gitnexus/src/core/ingestion/languages/c/import-target.ts +++ b/gitnexus/src/core/ingestion/languages/c/import-target.ts @@ -29,10 +29,13 @@ export function resolveCImportTarget( const siblingRaw = join(dirname(fromFile), targetRaw); const sibling = siblingRaw.replace(/\\/g, '/'); if (allFilePaths.has(sibling)) return sibling; - // Also try normalized target in case targetRaw has slashes - const siblingAlt = join(dirname(fromFile), normalizedTarget); - const siblingAltNorm = siblingAlt.replace(/\\/g, '/'); - if (siblingAltNorm !== sibling && allFilePaths.has(siblingAltNorm)) return siblingAltNorm; + // When targetRaw contains backslashes, the normalized form may + // resolve to a different sibling path — try it as well. + if (targetRaw !== normalizedTarget) { + const siblingAlt = join(dirname(fromFile), normalizedTarget); + const siblingAltNorm = siblingAlt.replace(/\\/g, '/'); + if (allFilePaths.has(siblingAltNorm)) return siblingAltNorm; + } } // Exact match (path as-is in the workspace)