]> git.ipfire.org Git - thirdparty/git.git/commit - config.c
config: disallow relative include paths from blobs
authorJeff King <peff@peff.net>
Tue, 18 Feb 2014 22:58:52 +0000 (00:58 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Feb 2014 00:12:09 +0000 (16:12 -0800)
commitd14d42440d8370f8fe5016a6e212d101745f70cc
tree74c9093cc6de89aa208252782f437bd798cde149
parent5f95c9f850b19b368c43ae399cc831b17a26a5ac
config: disallow relative include paths from blobs

When we see a relative config include like:

  [include]
  path = foo

we make it relative to the containing directory of the file
that contains the snippet. This makes no sense for config
read from a blob, as it is not on the filesystem.  Something
like "HEAD:some/path" could have a relative path within the
tree, but:

  1. It would not be part of include.path, which explicitly
     refers to the filesystem.

  2. It would need different parsing rules anyway to
     determine that it is a tree path.

The current code just uses the "name" field, which is wrong.
Let's split that into "name" and "path" fields, use the
latter for relative includes, and fill in only the former
for blobs.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/t1305-config-include.sh