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

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

  • Subject: [OCLUG-Tech] more git pedantry -- clarifications about .gitignore
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Wed, 29 Apr 2015 08:33:51 -0400 (EDT)
  some (hopefully) trivial questions about .gitignore, since the
actual documentation isn't as precise as it could be. as examples, i'm
going to use the top-level .gitignore file that comes with the kernel
source tree, since it seems that that file could be clearer.

  from the first part of the file:

.*
*.o
*.o.*
*.a
*.s
*.ko
*.so
... snip ...

  that first rule would seem to specify that all objects (file or
directory) that begin with a dot are to be ignored, which is fine.
after that, we get into more specific wildcards and, first question,
generic patterns like that will be applied in that directory and all
sub-directories, correct? (barring any sub-directories negating it).

  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/

the first two above being files, the second two obviously being
directories. if, however, i had specified just:

/debian

i am assuming it would still work (barring the unusual existence of a
top-level file named "debian", of course).

  given that, these few lines in the file seem odd:

#
# Generated include files
#
include/config
include/generated
arch/*/include/generated

  first, given that those entries are clearly directories, it would
have seemed clearer to have added slash suffixes. again, the lack of
the slash won't hurt, but since other parts of this .gitignore file
seem to use slashes for clarity, one would think the same should apply
here.

  and another thing ... why both of these lines?

include/generated
arch/*/include/generated

isn't there a wildcard pattern that would subsume both of those
entries?

  finally, would it not make more sense to replace things like:

Module.symvers

with

/Module.symvers

since i'm fairly sure you only get one of those, yes?

  i thought there was one more thing i wanted to ask, but i can't
remember what it was.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================