[PATCH v3 1/2] git.c: remove the_repository dependence in run_builtin()

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

 



run_builtin() takes a repo parameter, so the use of the_repository
is no longer necessary. Removed the usage of the_repository.

The comment preceding trace_repo_setup() was originally introduced
in commit a9ca8a85. Since get_git_dir() modifies global variables
such as git_dir and git_objects_dir which only valid when inside a git
repository. The intention of the comment was to emphasize that
get_git_dir() should not be called before confirming that the current
directory is indeed part of a git repository. However, get_git_dir()
has been renamed to repo_get_git_dir() in commit 246deeac. And later
in commit 73f192c9, repo_get_git_dir() stoped calling setup_get_env()
anymore. Rewrite origin comment message.

Signed-off-by: Lidong Yan <502024330056@xxxxxxxxxxxxxxxx>
---
 git.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/git.c b/git.c
index 77c4359522..7fa81dde18 100644
--- a/git.c
+++ b/git.c
@@ -462,12 +462,12 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct
 	precompose_argv_prefix(argc, argv, NULL);
 	if (use_pager == -1 && run_setup &&
 		!(p->option & DELAY_PAGER_CONFIG))
-		use_pager = check_pager_config(the_repository, p->cmd);
+		use_pager = check_pager_config(repo, p->cmd);
 	if (use_pager == -1 && p->option & USE_PAGER)
 		use_pager = 1;
 	if (run_setup && startup_info->have_repository)
-		/* get_git_dir() may set up repo, avoid that */
-		trace_repo_setup(the_repository);
+		/* avoid repo_get_git_dir(), repo must be set up */
+		trace_repo_setup(repo);
 	commit_pager_choice();
 
 	if (!help && p->option & NEED_WORK_TREE)
-- 
2.50.0-rc1





[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]

  Powered by Linux