Old-Man-Programmer / tree

Tree for Unix/LInux
GNU General Public License v2.0
151 stars 29 forks source link

The --gitignore option does not seem to work on directories starting with "/" #1

Open mig-hub opened 2 years ago

mig-hub commented 2 years ago

I have noticed this while fiddling around with the Rust programming language. Basically when creating a new project with Cargo, it creates a .gitignore automatically and ignores the "target" directory.

The command tree --gitignore still shows that "target" directory though.

But in the .gitignore it is written "/target" and not "target/" as I would personally do, so I am wondering if this is the reason why. I have seen many ignore files with a slash at the beginning even though I find this confusing. And Git also ignores these so I suppose it makes sense to make this consistent.

Old-Man-Programmer commented 2 years ago

I guess after re-reading the gitignore manual, that indeed all paths, even those starting with a / are relative to the directory of the .gitignore file. That is confusing. I guess I'll add that to the pile of things to fix.

On Mon, Apr 11, 2022 at 4:17 AM Mig @.***> wrote:

I have noticed this while fiddling around with the Rust programming language. Basically when creating a new project with Cargo, it creates a .gitignore automatically and ignores the "target" directory.

The command tree --gitignore still shows that "target" directory though.

But in the .gitignore it is written "/target" and not "target/" as I would personally do, so I am wondering if this is the reason why. I have seen many ignore files with a slash at the beginning even though I find this confusing. And Git also ignores these so I suppose it makes sense to make this consistent.

— Reply to this email directly, view it on GitHub https://github.com/Old-Man-Programmer/tree/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYK57MVTC5FSU4XR6EQ5ZDLVEPNZHANCNFSM5TCLXVBA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mig-hub commented 2 years ago

Yeah definitely confusing. Once I've seen this I've checked around and was surprised to see how many repos use this.

I am sure you have other things to fix first. I am a bit rusty on C but when I get time I'll see if I can fix this and submit a pull request.