From 1a4c861c884a5c0a709c1f8a3bb20de668b70d24 Mon Sep 17 00:00:00 2001 From: themanyone Date: Mon, 1 Jun 2026 18:37:15 -0800 Subject: [PATCH] fix: symlinks appearing as duplicates in pager stash #965 Date: Mon Jun 1 18:37:15 2026 -0800 modified: ui/ui.go details: stripAbsolutePath now uses filepath.Rel instead of EvalSymlinks. That way symlinks keep their own name in the stash. Tests pass. --- ui/ui.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/ui.go b/ui/ui.go index 9a295c0..4779811 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -470,9 +470,12 @@ func localFileToMarkdown(cwd string, res gitcha.SearchResult) *markdown { } func stripAbsolutePath(fullPath, cwd string) string { - fp, _ := filepath.EvalSymlinks(fullPath) cp, _ := filepath.EvalSymlinks(cwd) - return strings.ReplaceAll(fp, cp+string(os.PathSeparator), "") + rel, err := filepath.Rel(cp, fullPath) + if err != nil { + return fullPath + } + return rel } // Lightweight version of reflow's indent function.