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.
This commit is contained in:
themanyone 2026-06-01 18:37:15 -08:00
commit 1a4c861c88

View file

@ -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.