]> Cypherpunks.ru repositories - gostls13.git/commitdiff
.gitignore: fix attempt at rooted paths
authorRuss Cox <rsc@golang.org>
Wed, 4 Jan 2017 19:12:56 +0000 (14:12 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 5 Jan 2017 01:29:25 +0000 (01:29 +0000)
When I wrote the lines

bin/
pkg/

I was trying to match just the top-level bin and pkg directories, and I put the
final slash in because 'git help gitignore' says:

       o   If the pattern does not contain a slash /, Git treats it as a shell
           glob pattern and checks for a match against the pathname relative
           to the location of the .gitignore file (relative to the toplevel of
           the work tree if not from a .gitignore file).

       o   Otherwise, Git treats the pattern as a shell glob suitable for
           consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in
           the pattern will not match a / in the pathname. For example,
           "Documentation/*.html" matches "Documentation/git.html" but not
           "Documentation/ppc/ppc.html" or
           "tools/perf/Documentation/perf.html".

Putting a trailing slash was my way of opting in to the "rooted path" semantics
without looking different from the surrounding rooted paths like "src/go/build/zcgo.go".

But HA HA GIT FOOLED YOU! above those two bullets the docs say:

       o   If the pattern ends with a slash, it is removed for the purpose of
           the following description, ...

Change all the patterns to use a leading slash for "rooted" behavior.

This bit me earlier today because I had a perfectly reasonable source
code directory go/src/cmd/go/testdata/src/empty/pkg that was
not added by 'git add empty'.

Change-Id: I6f8685b3c5be22029c33de9ccd735487089a1c03
Reviewed-on: https://go-review.googlesource.com/34832
Reviewed-by: Ian Lance Taylor <iant@golang.org>
.gitignore

index 7173067a759c6f002a8e25510511d2e842c4dddb..552cf187ae83b5368a96d595c43bc84fb347629e 100644 (file)
@@ -18,28 +18,28 @@ _cgo_*
 _obj
 _test
 _testmain.go
-build.out
-test.out
-doc/articles/wiki/*.bin
-misc/cgo/life/run.out
-misc/cgo/stdio/run.out
-misc/cgo/testso/main
-src/cmd/cgo/zdefaultcc.go
-src/cmd/go/zdefaultcc.go
-src/cmd/go/zosarch.go
-src/cmd/internal/obj/zbootstrap.go
-src/go/build/zcgo.go
-src/go/doc/headscan
-src/runtime/internal/sys/zversion.go
-src/unicode/maketables
-src/*.*/
-test/pass.out
-test/run.out
-test/times.out
-test/garbage/*.out
-goinstall.log
-last-change
-VERSION.cache
 
-bin/
-pkg/
+/VERSION.cache
+/bin/
+/build.out
+/doc/articles/wiki/*.bin
+/goinstall.log
+/last-change
+/misc/cgo/life/run.out
+/misc/cgo/stdio/run.out
+/misc/cgo/testso/main
+/pkg/
+/src/*.*/
+/src/cmd/cgo/zdefaultcc.go
+/src/cmd/go/zdefaultcc.go
+/src/cmd/go/zosarch.go
+/src/cmd/internal/obj/zbootstrap.go
+/src/go/build/zcgo.go
+/src/go/doc/headscan
+/src/runtime/internal/sys/zversion.go
+/src/unicode/maketables
+/test.out
+/test/garbage/*.out
+/test/pass.out
+/test/run.out
+/test/times.out