Re: [PATCH 1/3] submodule: use absolute path for computing relative path connecting
From: Junio C Hamano <hidden>
Date: 2016-11-22 07:02:25
Stefan Beller [off-list ref] writes:
On Mon, Nov 21, 2016 at 1:03 PM, Stefan Beller [off-list ref] wrote:quoted
On Mon, Nov 21, 2016 at 1:01 PM, Junio C Hamano [off-list ref] wrote:quoted
Can the effect of this change demonstrated in a new test? There must be a scenario where the current behaviour is broken and this change fixes an incorrect computation of relative path, no?I do not think the current usage exposes this bug in connect_work_tree_and_git_dir. It is only used in builtin/mv.c, which fills the second parameter `git_dir` via a call to read_gitfile, which itself produces an absolute path.
OK. Fixing a potential bug as a preparatory step is good.
The current caller of connect_work_tree_and_git_dir passes an absolute path for the `git_dir` parameter. In the future patch we will also pass in relative path for `git_dir`. Extend the functionality of connect_work_tree_and_git_dir to take relative paths for parameters. We could work around this in the future patch by computing the absolute path for the git_dir in the calling site, however accepting relative paths for either parameter makes the API for this function easier to use.
Yup, sounds sensible. Thanks.