]> Cypherpunks repositories - gostls13.git/commit
cmd/pack: fix match
authorRuss Cox <rsc@golang.org>
Thu, 20 Feb 2014 20:50:30 +0000 (15:50 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 20 Feb 2014 20:50:30 +0000 (15:50 -0500)
commit258c278e12ba90502bb4805343592a926b6d9a7a
tree1d73b35015ae3b33ad68a67a601bd5bfed1420fe
parent574e0f9a4833a0c81bc4ea7efd9ea9bb46cb59b9
cmd/pack: fix match

Match used len(ar.files) == 0 to mean "match everything"
but it also deleted matched things from the list, so once you
had matched everything you asked for, match returned true
for whatever was left in the archive too.

Concretely, if you have an archive containing f1, f2, then
        pack t foo.a f1
would match f1 and then, because len(ar.files) == 0 after
deleting f1 from the match list, also match f2.

Avoid the problem by recording explicitly whether match
matches everything.

LGTM=r, dsymonds
R=r, dsymonds
CC=golang-codereviews
https://golang.org/cl/65630046
src/cmd/pack/pack.go
src/cmd/pack/pack_test.go