Subject: Submodules UX overhaul update (was: What's cooking in git.git (Nov 2021, #06; Wed, 24))

From: Emily Shaffer <[email-masked]>
Date: Mon, 29 Nov 2021 14:30:45 -0800

On Wed, Nov 24, 2021 at 09:56:53PM -0800, Junio C Hamano wrote:
> --------------------------------------------------
> [Stalled]
> 
> * ar/submodule-update (2021-10-13) 9 commits
>  . submodule--helper: rename helper functions
>  . submodule--helper: remove unused helpers
>  . submodule: move core cmd_update() logic to C
>  . submodule--helper: run update using child process struct
>  . submodule--helper: allow setting superprefix for init_submodule()
>  . submodule--helper: refactor get_submodule_displaypath()
>  . submodule--helper: rename helpers for update-clone
>  . submodule--helper: get remote names from any repository
>  . submodule--helper: split up ensure_core_worktree()
> 
>  Rewrite of "git submodule update" in C.
> 
>  Kicked out of 'seen' to make room for es/superproject-aware-submodules
>  which is among the topics this topic stomps on.

Update on es/superproject-aware-submodules to follow.

> --------------------------------------------------
> [Cooking]
> 
> * gc/remote-with-fewer-static-global-variables (2021-11-18) 5 commits
>  - remote: die if branch is not found in repository
>  - remote: remove the_repository->remote_state from static methods
>  - remote: use remote_state parameter internally
>  - remote: move static variables into per-repository struct
>  - t5516: add test case for pushing remote refspecs
> 
>  Code clean-up to eventually allow information on remotes defined
>  for an arbitrary repository to be read.
> 
>  Will merge to 'next'.

Thanks.

> * ab/config-based-hooks-2 (2021-11-24) 18 commits
>  - run-command: remove old run_hook_{le,ve}() hook API
>  - receive-pack: convert push-to-checkout hook to hook.h
>  - read-cache: convert post-index-change to use hook.h
>  - commit: convert {pre-commit,prepare-commit-msg} hook to hook.h
>  - git-p4: use 'git hook' to run hooks
>  - send-email: use 'git hook run' for 'sendemail-validate'
>  - git hook run: add an --ignore-missing flag
>  - hooks: convert worktree 'post-checkout' hook to hook library
>  - hooks: convert non-worktree 'post-checkout' hook to hook library
>  - merge: convert post-merge to use hook.h
>  - am: convert applypatch-msg to use hook.h
>  - rebase: convert pre-rebase to use hook.h
>  - hook API: add a run_hooks_l() wrapper
>  - am: convert {pre,post}-applypatch to use hook.h
>  - gc: use hook library for pre-auto-gc hook
>  - hook API: add a run_hooks() wrapper
>  - hook: add 'run' subcommand
>  - Merge branch 'ab/config-based-hooks-1' into ab/config-based-hooks-2
> 
>  More "config-based hooks".

I think I haven't looked at the update on 2021-11-01, so I probably owe
a review. Other reviews welcome, since I have bias :)

> * js/branch-track-inherit (2021-11-18) 1 commit
>  - branch: add flags and config to inherit tracking
> 
>  "git -c branch.autosetupmerge=inherit branch new old" makes "new"
>  to have the same upstream as the "old" branch, instead of marking
>  "old" itself as its upstream.

We're hoping this one will pave the way for a user to run simply 'git
push' from the superproject and have all submodules push to the correct
branch, even if it's different from the superproject's branch.

> * es/superproject-aware-submodules (2021-11-18) 5 commits
>  - submodule: use config to find superproject worktree
>  - submodule: record superproject gitdir during 'update'
>  - submodule: record superproject gitdir during absorbgitdirs
>  - introduce submodule.superprojectGitDir record
>  - t7400-submodule-basic: modernize inspect() helper
> 
>  A configuration variable in a submodule points at the location of
>  the superproject it is bound to (RFC).

Needs another reroll, but there is some quibbling over whether it makes
sense for this series to exist at all (or whether to just search the
filesystem every time we think we might be in a submodule). Ævar asked
for some benchmarking, I'll see if I can find some time.

Missing from this list, a few things we're still worried about:

Glen Choo: implement branch --recurse-submodules
https://lore.kernel.org/git/20211122223252.19922-1-chooglen%40google.com

An example implementation of 'git branch --recurse-submodules' in line
with the previously discussed RFC.

Jonathan Tan: Conditional config includes based on remote URL
https://patchwork.kernel.org/project/git/patch/cover.1637020610.git.jonathantanmy%40google.com

This one should allow users to distribute config-based hooks more
easily in managed environments where /etc/gitconfig is distributed to
all users, or by package manager via clever postinstall scripts.

 - Emily