Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > That "submodule_move_head()" function was then only invoked by > "read-tree" itself, but now rather than setting an environment > variable to pass "--super-prefix" between cmd_read_tree() we: > > - Set a new "super_prefix" in "struct unpack_trees_options". The > "super_prefixed()" function in "unpack-trees.c" added in [5] will now > use this, rather than get_super_prefix() looking up the environment > variable we set earlier in the same process. > > - Add the same field to the "struct checkout", which is only needed to > ferry the "super_prefix" in the "struct unpack_trees_options" all the > way down to the "entry.c" callers of "submodule_move_head()". > > Those calls which used the super prefix all originated in > "cmd_read_tree()". The only other caller is the "unlink_entry()" > caller in "builtin/checkout.c", which now passes a "NULL". > > 1. 74866d75793 (git: make super-prefix option, 2016-10-07) > 2. e77aa336f11 (ls-files: optionally recurse into submodules, 2016-10-07) > 3. 89c86265576 (submodule helper: support super prefix, 2016-12-08) > 4. 0281e487fd9 (grep: optionally recurse into submodules, 2016-12-16) > 5. 3d415425c7b (unpack-trees: support super-prefix option, 2017-01-17) > 6. 188dce131fa (ls-files: use repository object, 2017-06-22) > 7. f9ee2fcdfa0 (grep: recurse in-process using 'struct repository', 2017-08-02) > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> [...] > diff --git a/submodule.h b/submodule.h > index e5ee13fb06a..36a7f7c5b32 100644 > --- a/submodule.h > +++ b/submodule.h > @@ -150,9 +150,8 @@ int validate_submodule_git_dir(char *git_dir, const char *submodule_name); > > #define SUBMODULE_MOVE_HEAD_DRY_RUN (1<<0) > #define SUBMODULE_MOVE_HEAD_FORCE (1<<1) > -int submodule_move_head(const char *path, > - const char *old, > - const char *new_head, > +int submodule_move_head(const char *path, const char *super_prefix, > + const char *old_head, const char *new_head, > unsigned flags); > > void submodule_unset_core_worktree(const struct submodule *sub); This signature change turned out to be far less disruptive than I expected, nice. It helps that we already had a natural home for these, i.e. "struct checkout" and "struct unpack_trees_options".