git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brandon Williams <bmwill@google.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Jeff King <peff@peff.net>,
	git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3 6/6] Use the early config machinery to expand aliases
Date: Wed, 14 Jun 2017 10:20:57 -0700	[thread overview]
Message-ID: <20170614172057.GC55677@google.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1.1706141223021.171564@virtualbox>

On 06/14, Johannes Schindelin wrote:
> Hi Peff & Brandon,
> 
> On Wed, 14 Jun 2017, Jeff King wrote:
> 
> > On Tue, Jun 13, 2017 at 11:26:06AM -0700, Brandon Williams wrote:
> > 
> > > So because I've been looking at the config machinery lately, I've
> > > noticed a lot of issues with how things are handled with respect to
> > > gitdir vs commondir.  Essentially the config resides at commondir/config
> > > always, and only at gitdir/config when not working with a worktree.
> > > Because of this, your patches point out a bug in how early config is
> > > handled.  I'll illustrate this using aliases.
> > > 
> > > Before this series (because aliases are read using the standard config
> > > machinery):
> > > 
> > >   > git init main
> > >   > git -C main config alias.test '!echo hello'
> > >   > git -C main test
> > >     hello
> > >   > git -C main worktree add ../worktree
> > >   > git -C worktree test
> > >     hello
> > > 
> > > After this series (using read_early_config()):
> > > 
> > >   > git init main
> > >   > git -C main config alias.test '!echo hello'
> > >   > git -C main test
> > >     hello
> > >   > git -C main worktree add ../worktree
> > >   > git -C worktree test
> > >     git: 'test' is not a git command. See 'git --help'.
> > > 
> > > The issue is that read_early_config passes the gitdir and not the
> > > commondir when reading the config.
> > 
> > Good catch.
> 
> Oh wow.
> 
> > > The solution would be to add a 'commondir' field to the config_options
> > > struct and populate that before reading the config.  I'm planning on
> > > fixing this in v2 of my config cleanup series which I'll hopefully have
> > > finished by the end of the day.
> > 
> > I think that read_early_config() really meant to set the commondir, as
> > it was always about actual config-file lookup. So it was sort-of buggy
> > already, though I suspect it was pretty hard to trigger.
> > 
> > But I agree that since include_by_gitdir now reads the same struct
> > field, swapping it out fixes the config-reading at the cost of breaking
> > that function. And we really need to pass both in.
> > 
> > I'm not sure whether we should care about this for Dscho's series or
> > not. I think his series _does_ make the problem easier to trigger. But
> > it's a minor enough bug that I think I'd be OK with letting your
> > solution proceed independently.
> 
> Brandon, how hard would it be to build on top of my series? I ask because
> I have to take care of some other things and would not have the time to
> adjust my patch series on top of yours anytime soon.

It should be pretty easy to just rebase ontop of your series.  I'll make
sure to do that before sending out the next revision of mine.

-- 
Brandon Williams

      reply	other threads:[~2017-06-14 17:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 12:04 [PATCH v3 0/6] Avoid problem where git_dir is set after alias expansion Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 1/6] discover_git_directory(): avoid setting invalid git_dir Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 2/6] config: report correct line number upon error Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 3/6] help: use early config when autocorrecting aliases Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 4/6] t1308: relax the test verifying that empty alias values are disallowed Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 5/6] t7006: demonstrate a problem with aliases in subdirectories Johannes Schindelin
2017-06-13 12:04 ` [PATCH v3 6/6] Use the early config machinery to expand aliases Johannes Schindelin
2017-06-13 16:21   ` Junio C Hamano
2017-06-14  6:05     ` Jeff King
2017-06-14 10:21       ` Johannes Schindelin
2017-06-14 10:20     ` Johannes Schindelin
2017-06-13 18:26   ` Brandon Williams
2017-06-14  5:58     ` Jeff King
2017-06-14 10:24       ` Johannes Schindelin
2017-06-14 17:20         ` Brandon Williams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170614172057.GC55677@google.com \
    --to=bmwill@google.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).