mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-23 00:24:17 +02:00
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:
parent
4abc462f8e
commit
1a4c861c88
1 changed files with 5 additions and 2 deletions
7
ui/ui.go
7
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue