home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] more git pedantry -- clarifications about .gitignore

  • Subject: Re: [OCLUG-Tech] more git pedantry -- clarifications about .gitignore
  • From: Stephen Kraemer <straemer [ at ] gmail [ dot ] com>
  • Date: Wed, 29 Apr 2015 12:29:34 -0400


On 2015-04-29 12:26, Robert P. J. Day wrote:
On Wed, 29 Apr 2015, Richard Guy Briggs wrote:

On 15/04/29, Robert P. J. Day wrote:
On Wed, 29 Apr 2015, Richard Guy Briggs wrote:

On 15/04/29, Robert P. J. Day wrote:

   next question -- a pattern will apply to *any* file type (file or
directory), unless suffixed with a slash, whereupon it will apply only
to a directory, yes? this would appear to be the case since the kernel
.gitignore contains the following lines:

/vmlinux
/System.map
...
/debian/
/tar-install/

I assume the "/" prefix anchors it in the root of the git tree...

   well, that was one of the confusing bits as i mentioned earlier ...
what does it mean if it shows up in a lower-level .gitignore. the man
page states thusly:

   A leading slash matches the beginning of the pathname. For example,
   "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

but if it's in a subdirectory, does it mean the pathname relative to
that subdirectory? the man page doesn't make that clear.

I would have assumed relative to the subdirectory, so the arch
example you presented earlier, both would match.

   i would have assumed the same but, i swear, that situation is not
addressed clearly in the man page. one would think this interpretation
would be the correct one since it's so *obviously* the most useful
interpretation, and i would have expected to see it used frequently in
the kernel source tree.

   oddly, in all of the kernel .gitignore files, that occurs only once
in tools/thermal/tmon/.gitignore, whose entire contents are:

/tmon

which represents the executable generated by building that tool, so
that makes perfect sense, but sure doesn't explain why there is not a
single other occurrence of that structure anywhere in the tree. weird.

   the more i read the man page, the confuseder i get.

rday


I believe I read somewhere that the paths are relative to the location of the .gitignore file itself, and that you can have multiple .gitignore files in a git tree. Apparently the man page doesn't actually make this specification though.

-Stephen