Re: [PATCH] git.c: remove the_repository dependence in run_builtin()

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

 



Junio C Hamano <gitster@xxxxxxxxx> 写道:
> 
> Lidong Yan <yldhome2d2@xxxxxxxxx> writes:
> 
>> run_builtin() takes a repo parameter, so the use of the_repository
>> is no longer necessary. Removed the usage of the_repository.
> 
> Good.  The caller always calls this function with the_repository, so
> this patch does not change anything in the bigger picture.
> 
>> The comment before trace_repo_setup() advises not to use get_git_dir(),
>> but this note is unrelated to trace_repo_setup() itself. Additionally,
>> get_git_dir() has now been renamed to repo_get_git_dir(). Remove this
>> comment line.
> 
> Isn't it still relevant to explain the reason why this codepath
> avoids calling the repo_get_git_dir() function?
> 
> e5b17bda (git: ensure correct git directory setup with -h,
> 2021-12-06) tells us that the comment is about use of
> startup_info->have_repository, which was added by a9ca8a85
> (builtins: print setup info if repo is found, 2010-11-26).

In commit a9ca8a85, the intention was to avoid calling get_git_dir() before
confirming that we are indeed inside a Git repository and determining the prefix
between the current working directory and the repository root.

However, I believe this concern is no longer relevant:
repo_get_git_dir() no longer sets up the Git repository environment as the
original comment implied. Instead, all the necessary setup is now handled
by setup_git_env(), which is invoked by setup_git_directory_gently() after
the prefix has been determined. As a result, I believe it is no longer necessary
to retain this comment message.




[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