Re: [PATCH 1/4] config: add include directive
- From
Jeff King <peff@peff.net>
- Date
- Jan 26, 2012, 16:54 UTC
- Message-ID
- <20120126165456.GA5278@sigill.intra.peff.net>
- In-Reply-To
- <4F2119E6.8010109@viscovery.net>
On Thu, Jan 26, 2012 at 10:16:22AM +0100, Johannes Sixt wrote:
Show 15 quoted lines
> > +test_expect_success 'recursive relative paths' ' > > + mkdir subdir && > > + echo "[test]three = 3" >subdir/three && > > + echo "[include]path = three" >subdir/two && > > + echo "[include]path = subdir/two" >base && > > + echo 3 >expect && > > + git config -f base test.three >actual && > > + test_cmp expect actual > > +' > > Isn't it rather "chained relative paths"? Recursive would be if I write > > [include]path = .gitconfig > > in my ~/.gitconfig. What happens in this case?
Good point. I used "recursive" because it is recursing in the include function within git, but obviously from the user's perspective, it is not a recursion.
And no, I didn't do any cycle detection. We could either do:
1. Record some canonical name for each source we look at (probably
realpath() for files, and the sha1 for refs), and don't descend
into already-seen sources.2. Simply provide a maximum depth, and don't include beyond it.
The latter is much simpler to implement, but I think the former is a little nicer for the user.
-Peff