[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/11 v2] gitignore: Move ignores from global to subdirectories



On Thu, Sep 10, 2020 at 11:13:26AM +0200, Jan Beulich wrote:
> On 27.08.2020 21:09, Elliott Mitchell wrote:
> > --- a/tools/misc/.gitignore
> > +++ b/tools/misc/.gitignore
> > @@ -1 +1,22 @@
> > -xen-ucode
> > +/cpuperf/cpuperf-perfcntr
> > +/cpuperf/cpuperf-xen
> > +/lowmemd
> > +/xc_shadow
> > +/xen-cpuid
> > +/xen-detect
> > +/xen-diag
> > +/xen-hptool
> > +/xen-hvmcrash
> > +/xen-hvmctx
> > +/xen-livepatch
> > +/xen-lowmemd
> > +/xen-mfndump
> > +/xen-tmem-list-parse
> > +/xen-ucode
> > +/xen_cpuperf
> > +/xencov
> > +/xenhypfs
> > +/xenlockprof
> > +/xenperf
> > +/xenpm
> > +/xenwatchdogd
> 
> The earlier discussion had left me with the impression that the ./
> form would be slightly better to use to avoid puzzling the
> occasional reader. Did I overlook or mis-interpret anything? Did you
> come to the conclusion that / is better, but forgot to mention the
> "why" in at least the cover letter?

Some of Xen's documentation isn't that great, even though most of `git`'s
documentation is quite good a few pieces aren't so great.  The
information on how .gitignore files are treated is less than wonderful.

I had *thought* "./" would restrict to capturing files in the current
directory, but after some testing and then some reading of the
documentation (oh, `git check-ignore` is a thing).  Then reading the
documentation again.  Then reading the documentation *again*.  I found an
initial "/" restricts a pattern to the current directory, but `git`
doesn't handle "./".

Apparently a pattern with a slash *anywhere* besides the *end* (which
includes the very start) will be treated as a full path relative to the
current directory.  As such "foo/bar" and "/foo/bar" are equivalent.  Yet
"foo" and "/foo" are *not* equivalent.

Meanwhile a slash at the end tells `git` to *only* match a directory.

Then you have "**" which will match zero or more directories.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg@xxxxxxx  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.