From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Brandon Williams <bmwill@google.com>
Subject: Re: [PATCH v3 6/6] Use the early config machinery to expand aliases
Date: Tue, 13 Jun 2017 09:21:30 -0700 [thread overview]
Message-ID: <xmqqk24f97ud.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <822765b002488f03523bf440097492be3c14931a.1497355444.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Tue, 13 Jun 2017 14:04:39 +0200 (CEST)")
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> Instead of discovering the .git/ directory, read the config and then
> trying to painstakingly reset all the global state if we did not find a
> matching alias, let's use the early config machinery instead.
s/read/&ing/, I think. My reading hiccupped while trying to figure
out what two alternative approaches are being compared.
> It may look like unnecessary work to discover the .git/ directory in the
> early config machinery and then call setup_git_directory_gently() in the
> case of a shell alias, repeating the very same discovery *again*.
> However, we have to do this as the early config machinery takes pains
> *not* to touch any global state, while shell aliases expect a possibly
> changed working directory and at least the GIT_PREFIX and GIT_DIR
> variables to be set.
Makes sense. Nicely explained.
> Also, one might be tempted to streamline the code in alias_lookup() to
> *not* use a strbuf for the key. However, if the config reports an error,
> it is far superior to tell the user that the `alias.xyz` key had a
> problem than to claim that it was the `xyz` key.
The mention of "streamline" is puzzling to me. When we are trying
"git xyz", "alias.xyz" is the key we would look up, not "xyz"; it is
not clear to anybody who didn't read the discussion on v2 (which
includes the readers of "git log" in a few months) what kind of flawed
streamlining could look up "xyz" and result in a bad configuration
reported on it.
> alias.c | 31 ++++++++++++++++++++++++-------
> git.c | 55 ++++---------------------------------------------------
> t/t7006-pager.sh | 2 +-
> 3 files changed, 29 insertions(+), 59 deletions(-)
Happy to see the deletion of all the save/restore-env stuff.
Except for the puzzlement in one paragraph in the log, looks very
good. Thanks for a pleasant reading.
next prev parent reply other threads:[~2017-06-13 16: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 [this message]
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
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=xmqqk24f97ud.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.