(path string)
| 100 | } |
| 101 | |
| 102 | func currentBranchFor(path string) string { |
| 103 | wts, err := git.ListWorktrees(path) |
| 104 | if err != nil { |
| 105 | return "" |
| 106 | } |
| 107 | pathResolved := resolveSymlinksOrSelf(path) |
| 108 | for _, w := range wts { |
| 109 | if resolveSymlinksOrSelf(w.Path) == pathResolved { |
| 110 | return w.Branch |
| 111 | } |
| 112 | } |
| 113 | return "" |
| 114 | } |
| 115 | |
| 116 | func resolveSymlinksOrSelf(path string) string { |
| 117 | resolved, err := filepath.EvalSymlinks(path) |
no test coverage detected