From: Evan Silberman Subject: Re: leading separators in ignore patterns To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Mon, 19 May 2025 11:03:49 -0700 Stefan Sperling wrote: > I have one small suggestion for your patch. In any case, your patch > looks very good to me. Thanks! > > > /* > > + * For gitignore(7) compatibility, ignore leading slashes > > + */ > > + if (len > 0 && pat[0] == '/') { > > + pat++; > > + len--; > > + } > > If the above was a while-loop instead of an if-statement then you could > do the following in your test and the test would keep passing: It would but that would actually worsen compatibility with gitignore(7), consider: asdf $ cat .gitignore /nu //iota asdf $ tree . |-- b | |-- iota | | `-- a | `-- nu | `-- a |-- iota | `-- a `-- nu `-- a 5 directories, 4 files asdf $ git status -s ?? .gitignore ?? b/ ?? iota/ So I think we don't want to change that, since git also seems to treat only the first `/` specially in this way. Thanks for the feedback, and the encouragement to follow through with the patch. E