Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-17 Thread Junio C Hamano
Michael Haggerty writes: > If I understand correctly, you consider the decision of where a > particular reference should be stored to be a kind of "business logic" > decision that should live outside of the refs module. I don't think it > is so important whether this knowledge is inside or outsid

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-16 Thread Duy Nguyen
On Sun, Aug 16, 2015 at 12:04 PM, David Turner wrote: > Duy Nguyen writes: >> On Thu, Aug 13, 2015 at 4:57 AM, David Turner > wrote: >> > Instead of a linear search over common_list to check whether >> > a path is common, use a trie. The trie search operates on >> > path prefixes, and handles e

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-15 Thread David Turner
Duy Nguyen writes: > On Thu, Aug 13, 2015 at 4:57 AM, David Turner wrote: > > Instead of a linear search over common_list to check whether > > a path is common, use a trie. The trie search operates on > > path prefixes, and handles excludes. > > Just be careful that the given key from git_path

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-15 Thread Michael Haggerty
On 08/14/2015 10:04 PM, David Turner wrote: > On Fri, 2015-08-14 at 10:04 -0700, Junio C Hamano wrote: >> [...] >> So I think we should have *three* functions: >> >> - git_workspace_name(void) returns some name that uniquely >>identifies the current workspace among the workspaces linked to >>

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-15 Thread Michael Haggerty
On 08/14/2015 07:04 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Let's take a step back. >> >> We have always had a ton of code that uses `git_path()` and friends to >> convert abstract things into filesystem paths. Let's take the >> reference-handling code as an example: >> ... >> T

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-15 Thread Duy Nguyen
On Thu, Aug 13, 2015 at 4:57 AM, David Turner wrote: > Instead of a linear search over common_list to check whether > a path is common, use a trie. The trie search operates on > path prefixes, and handles excludes. Just be careful that the given key from git_path is not normalized. I think you a

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-14 Thread David Turner
On Fri, 2015-08-14 at 13:27 -0700, Junio C Hamano wrote: > David Turner writes: > > > Random side note: the present workspace path name component is not > > acceptable for this if alternate ref backends use a single db for > > storage across all workspaces. That's because you might create a > >

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-14 Thread Junio C Hamano
David Turner writes: > Random side note: the present workspace path name component is not > acceptable for this if alternate ref backends use a single db for > storage across all workspaces. That's because you might create a > workspace at foo, then manually rm -r it, and then create a new one a

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-14 Thread David Turner
On Fri, 2015-08-14 at 10:04 -0700, Junio C Hamano wrote: > Michael Haggerty writes: > > > Let's take a step back. > > > > We have always had a ton of code that uses `git_path()` and friends to > > convert abstract things into filesystem paths. Let's take the > > reference-handling code as an exam

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-14 Thread Junio C Hamano
Michael Haggerty writes: > Let's take a step back. > > We have always had a ton of code that uses `git_path()` and friends to > convert abstract things into filesystem paths. Let's take the > reference-handling code as an example: > ... > This seems crazy to me. It is the *reference* code that sh

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-13 Thread Michael Haggerty
On 08/12/2015 11:57 PM, David Turner wrote: > Instead of a linear search over common_list to check whether > a path is common, use a trie. The trie search operates on > path prefixes, and handles excludes. > > Signed-off-by: David Turner > --- > > Probably overkill, but maybe we could later use

Re: [PATCH v3 2/4] path: optimize common dir checking

2015-08-12 Thread Junio C Hamano
David Turner writes: > Instead of a linear search over common_list to check whether > a path is common, use a trie. The trie search operates on > path prefixes, and handles excludes. > > Signed-off-by: David Turner > --- > > Probably overkill, but maybe we could later use it for making exclude

[PATCH v3 2/4] path: optimize common dir checking

2015-08-12 Thread David Turner
Instead of a linear search over common_list to check whether a path is common, use a trie. The trie search operates on path prefixes, and handles excludes. Signed-off-by: David Turner --- Probably overkill, but maybe we could later use it for making exclude or sparse-checkout matching faster (o