From: K Jayatheerth Date: Tue, 03 Nov 2026 02:08:01 GMT Subject: Re: [GSoC Patch v7 2/8] submodule: use repository to find superproject Message-ID: In-Reply-To: On Tue, Nov 3, 2026 at 3:06 AM Justin Tobler wrote: > > On 26/09/27 05:14PM, K Jayatheerth wrote: > > `get_superproject_working_tree()` currently uses `xgetcwd()` to > > determine the repository whose superproject should be checked. > > > > This is incorrect when `--git-dir` points to a repository different > > from the one associated with the current working directory. In that > > case, the current working directory may cause the function to return > > the wrong superproject or an empty result. > > Ok, so we are not taking into account here that the git dir location > could be different than the current working directory. > > > Pass the `repository` to `get_superproject_working_tree()` so that the > > superproject is determined from the repository being inspected rather > > than the current working directory. > [snip] > [snip] > > +test_expect_success 'path.superproject-root works with --git-dir' ' > > + test_when_finished "rm -rf sub super" && > > + git init sub && > > + test_commit -C sub initial && > > + git init super && > > + ( > > + cd super && > > + git -c protocol.file.allow=always submodule add "../sub" sub && > > + git commit -m "add submodule" && > > + > > + SUPER_ROOT="$(test-tool path-utils real_path .)" && > > + MODULE_DIR="$SUPER_ROOT/.git/modules/sub" && > > + > > + echo "path.superproject-root.absolute=$SUPER_ROOT" >expect && > > + git --git-dir="$MODULE_DIR" repo info path.superproject-root.absolute >actual && > > `path.superproject-root` isn't introduced until the next patch, so this > test fails at this commit. Maybe the test should exercise the existing > `git --git-dir=... rev-parse --show-superproject-working-tree` caller in > t1500 instead? > Right, It was meant to use rev-parse. I will make the change. - K Jayatheerth