nd/setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]