jorgebucaran / hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
MIT License
637 stars 53 forks source link

Handle replication of git base path within full path #47

Open renatofq opened 1 year ago

renatofq commented 1 year ago

That's maybe too specific but I have a directory structure somewhat like this

~/projects ❱ tree -L 2
.
├── project_a
│   ├── dev_project_a
│   ├── prd_project_a
│   ├── project_a
│   └── stg_project_a
└── project_b
    ├── dev_project_b
    ├── prd_project_b
    ├── project_b
    └── stg_project_b

Where all of these leaves are git repos. The thing is, when I get into ~/projects/project_a/project_a, the prompt is shown like this

~/p/project_a/project_a master ❱

And when I I get into ~/projects/project_a/project_a/src it goes like that

~/p/project_a/p/src master ❱

I've made a small patch to fix it

24c24
<         string replace -- "/$git_base/" /:/ |
---
>         string replace --regex -- "/($git_base)(?!.*\1)/" "/:/" |