From f689c90084a025da025a957db91bdc3eb373896a Mon Sep 17 00:00:00 2001 From: Shane-XB-Qian Date: Tue, 11 Feb 2025 21:53:34 +0800 Subject: [PATCH] fix: correct abs to rel path conversion (#683) --- ui/ui.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index dbc6fd7..dc4ce87 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -425,8 +425,9 @@ func localFileToMarkdown(cwd string, res gitcha.SearchResult) *markdown { } func stripAbsolutePath(fullPath, cwd string) string { - path, _ := filepath.Rel(cwd, fullPath) - return path + fp, _ := filepath.EvalSymlinks(fullPath) + cp, _ := filepath.EvalSymlinks(cwd) + return strings.ReplaceAll(fp, cp+string(os.PathSeparator), "") } // Lightweight version of reflow's indent function.