From: Jonathan Nieder <jrnieder@gmail.com>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git <git@vger.kernel.org>
Subject: nd/setup
Date: Sat, 3 Apr 2010 00:00:57 -0500 [thread overview]
Message-ID: <20100403050057.GA20525@progeny.tock> (raw)
In-Reply-To: <j2wfcaeb9bf1004020423nc5b7a73cq2278d41d1675dc8f@mail.gmail.com>
Nguyen Thai Ngoc Duy wrote:
> I haven't forgotten the "git init" with alias bug Jonathan found. Just
> a little busy with other stuff.
You already fixed it, I think. ;-)
Unfortunately, I have also run into a double-initialization bug with
clone. I haven’t figured out how to reproduce it yet; once I do, I’ll
send a patch.
Overall, I think this series does a good thing, so I am anxious to find
all the bugs I can so the wrinkles get ironed out.
Here’s another tiny issue.
-- %< --
Subject: Revert "help: use RUN_SETUP_GENTLY"
Commit 717b8850580ecb9009505f71ea43ecda51ac1f0e taught ‘git help’
to unconditionally looks for a git directory, with the justification:
So the sooner we set up gitdir, the less trouble we may have to
deal with.
In the case of ‘git help -a’, that is not quite true. In automount
setups like that which prompted v1.6.0-rc0~121^2~1 (Add support for
GIT_CEILING_DIRECTORIES, 2008-05-19), if GIT_CEILING_DIRECTORIES is
unset, then probing for the Git directory can take a long time. Thus
unnecessarily searching for a git directory can slow down ‘git help -a’
(and thus bash completion).
‘git help’ does not use RUN_SETUP or USE_PAGER, and neither option
parsing nor producing output for plain ‘git help’ or ‘git help -a’
requires access to the git configuration. Therefore it is safe to not
search for the git directory early in this case.
Also add some comments to document the requirements this places on
list_commands() and list_common_cmds_help().
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
builtin/help.c | 7 +++++++
git.c | 2 +-
help.c | 4 ++++
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/builtin/help.c b/builtin/help.c
index 4988629..68b72df 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -271,6 +271,11 @@ static int git_help_config(const char *var, const char *value, void *cb)
static struct cmdnames main_cmds, other_cmds;
+/*
+ * Used for plain ‘git’ and ‘git help’.
+ * Therefore this should not use git_config(), nor any other function
+ * that requires searching for a repository.
+ */
void list_common_cmds_help(void)
{
int i, longest = 0;
@@ -414,6 +419,7 @@ static void show_html_page(const char *git_cmd)
int cmd_help(int argc, const char **argv, const char *prefix)
{
+ int unused_nongit;
const char *alias;
enum help_format parsed_help_format;
load_command_list("git-", &main_cmds, &other_cmds);
@@ -436,6 +442,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
return 0;
}
+ setup_git_directory_gently(&unused_nongit);
git_config(git_help_config, NULL);
if (parsed_help_format != HELP_FORMAT_NONE)
diff --git a/git.c b/git.c
index 5c249fd..0125152 100644
--- a/git.c
+++ b/git.c
@@ -335,7 +335,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "get-tar-commit-id", cmd_get_tar_commit_id },
{ "grep", cmd_grep, RUN_SETUP_GENTLY | USE_PAGER },
{ "hash-object", cmd_hash_object, RUN_SETUP_GENTLY },
- { "help", cmd_help, RUN_SETUP_GENTLY },
+ { "help", cmd_help },
{ "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
{ "init", cmd_init_db },
{ "init-db", cmd_init_db },
diff --git a/help.c b/help.c
index 7f4928e..f68ef43 100644
--- a/help.c
+++ b/help.c
@@ -221,6 +221,10 @@ void load_command_list(const char *prefix,
exclude_cmds(other_cmds, main_cmds);
}
+/*
+ * Used for ‘git help -a’. Therefore this should not use git_config(),
+ * nor any other function that requires searching for a repository.
+ */
void list_commands(const char *title, struct cmdnames *main_cmds,
struct cmdnames *other_cmds)
{
--
1.7.0.3
next prev parent reply other threads:[~2010-04-03 5:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-02 8:40 What's cooking in git.git (Apr 2010, #01; Fri, 02) Junio C Hamano
2010-04-02 11:23 ` Nguyen Thai Ngoc Duy
2010-04-03 5:00 ` Jonathan Nieder [this message]
2010-04-03 14:39 ` nd/setup Nguyen Thai Ngoc Duy
2010-04-04 18:41 ` nd/setup Nguyen Thai Ngoc Duy
2010-04-04 21:42 ` nd/setup Junio C Hamano
2010-04-02 16:48 ` What's cooking in git.git (Apr 2010, #01; Fri, 02) Sverre Rabbelier
2010-04-03 4:58 ` Nicolas Pitre
-- strict thread matches above, loose matches on Subject: below --
2010-04-08 0:48 What's cooking in git.git (Apr 2010, #03; Wed, 07) Junio C Hamano
2010-04-08 7:38 ` Jeff King
2010-04-08 21:42 ` nd/setup Jonathan Nieder
2010-04-09 0:13 ` nd/setup Jeff King
2010-04-09 5:46 ` nd/setup Nguyen Thai Ngoc Duy
2010-04-09 5:57 ` nd/setup Jonathan Nieder
2010-04-09 6:56 ` nd/setup Nguyen Thai Ngoc Duy
2010-04-11 17:57 ` nd/setup Nguyen Thai Ngoc Duy
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=20100403050057.GA20525@progeny.tock \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
/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).