Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-14 Thread Johannes Schindelin
Hi Junio, On Tue, 13 Jun 2017, Junio C Hamano wrote: > Jeff King writes: > > > On Tue, Jun 13, 2017 at 01:42:02PM +0200, Johannes Schindelin wrote: > > > >> > As you probably guessed, I had tried that first and then figured that if > >> > I needed to keep the config_key_is_valid() test anyway,

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Jeff King
On Tue, Jun 13, 2017 at 09:40:49AM -0700, Junio C Hamano wrote: > >> It is really tempting to avoid the extra strbuf, but then the error > >> message would change from > >> > >>error: missing value for 'alias.br' > >> > >> to > >> > >>error: missing value for 'br' > >> > >> which is of

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Junio C Hamano
Jeff King writes: > On Tue, Jun 13, 2017 at 01:42:02PM +0200, Johannes Schindelin wrote: > >> > As you probably guessed, I had tried that first and then figured that if >> > I needed to keep the config_key_is_valid() test anyway, I could just as >> > well keep the strbuf around for later use. >>

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Jeff King
On Tue, Jun 13, 2017 at 01:42:02PM +0200, Johannes Schindelin wrote: > > As you probably guessed, I had tried that first and then figured that if > > I needed to keep the config_key_is_valid() test anyway, I could just as > > well keep the strbuf around for later use. > > > > Will change the code

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Johannes Schindelin
Hi Peff, On Tue, 13 Jun 2017, Johannes Schindelin wrote: > On Sat, 10 Jun 2017, Jeff King wrote: > > > On Thu, Jun 08, 2017 at 09:53:50PM +0200, Johannes Schindelin wrote: > > > > > -char *alias_lookup(const char *alias) > > > [...] > > > { > > > - char *v = NULL; > > > - struct strbuf key = S

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Jeff King
On Tue, Jun 13, 2017 at 01:21:28PM +0200, Johannes Schindelin wrote: > > Two optional cleanups here: > > > > 1. We don't need to call config_key_is_valid when using a callback. We > > only needed that to prevent the configset machinery from issuing a > > warning. It does save us readi

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-13 Thread Johannes Schindelin
Hi Peff, On Sat, 10 Jun 2017, Jeff King wrote: > On Thu, Jun 08, 2017 at 09:53:50PM +0200, Johannes Schindelin wrote: > > > -char *alias_lookup(const char *alias) > > [...] > > { > > - char *v = NULL; > > - struct strbuf key = STRBUF_INIT; > > - strbuf_addf(&key, "alias.%s", alias); > > -

Re: [PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-10 Thread Jeff King
On Thu, Jun 08, 2017 at 09:53:50PM +0200, Johannes Schindelin wrote: > -char *alias_lookup(const char *alias) > [...] > { > - char *v = NULL; > - struct strbuf key = STRBUF_INIT; > - strbuf_addf(&key, "alias.%s", alias); > - if (git_config_key_is_valid(key.buf)) > - gi

[PATCH v2 7/8] alias_lookup(): optionally return top-level directory

2017-06-08 Thread Johannes Schindelin
When an alias expands to a shell command, and when we are inside a regular worktree's subdirectory (i.e. not inside the .git/ directory nor in a worktree initialized via `git worktree add`), and only then, the current working directory is switched to the top-level directory of the worktree before r