Hi Stefan, On Mon, 24 Sep 2018 14:00:50 -0700 Stefan Beller <sbeller@xxxxxxxxxx> wrote: > On Mon, Sep 24, 2018 at 3:20 AM Antonio Ospite <ao2@xxxxxx> wrote: > [...] > > This is a limitation of the object store in git, there is no equivalent > > of get_oid() to get the oid from a specific repository and this affects > > config_with_options too when the config source is a blob. > > Not yet, as there is a big push to pass-through an object-store object > or similar recently and rely less on global variables. > I am not sure I get to this code, though. > If you end up touching get_oid() please CC me. > > This does not affect commands called via "git -C submodule_dir cmd" > > because in that case the chdir happens before the_repository is set up, > > for instance "git-submodule $SOMETHING --recursive" commands seem to > > change the working directory before the recursion. > > For this it may be worth looking into the option > --super-prefix=<path> > Currently for internal use only. Set a prefix which gives a > path from above a repository down to its root. One use is > to give submodules context about the superproject that > invoked it. > My comment wanted to highlight that there are NO problems in the mentioned cases: - git -C submodule_dir cmd - git submodule cmd --recursive Are you suggesting to look into super-prefix for any reason in particular? [...] > > The test suite passes even after removing repo_read_gitmodules() > > entirely from builtin/grep.c, but I am still not confident that I get > > all the implication of why that call was originally added in commit > > f9ee2fcdfa (grep: recurse in-process using 'struct repository', > > 2017-08-02). > > If you checkout that commit and remove the call to repo_read_gitmodules > and then call git-grep in a superproject with nested submodules, you > get a segfault. > > On master (and deleting out that line) you do not get the segfault, > I think praise goes to ff6f1f564c4 (submodule-config: lazy-load a > repository's .gitmodules file, 2017-08-03) which happened shortly > after f9ee2fcdfa. > > It showcased that it worked by converting ls-files, but left out grep. > > So I think based on ff6f1f564c4 it is safe to remove all calls to > repo_read_gitmodules. > Thanks for confirming. > > Anyways, even if we removed the call we would prevent the problem from > > happening in the test suite, but not in the real world, in case non-leaf > > submodules without .gitmodules in their working tree. > > Quite frankly I think grep was just overlooked in review of > https://public-inbox.org/git/20170803182000.179328-14-bmwill@xxxxxxxxxx/ > OK, so the plan for v6 is: - avoid the corruption issues spotted by Gábor by removing the call to repo_read_gitmodules in builtin/grep.c (this still does not fix the potential problem with nested submodules). - add a new test-tool which better exercises the new config_from_gitmodules code, - add also a test_expect_failure test to document the use case that cannot be supported yet: nested submodules without .gitmodules in their working tree. Thanks, Antonio -- Antonio Ospite https://ao2.it https://twitter.com/ao2it A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing?