On Fri, Jun 23, 2017 at 1:04 PM, Brandon Williams <bmwill@xxxxxxxxxx> wrote: > In 06bf4ad1d (push: propagate remote and refspec with > --recurse-submodules) push was taught how to propagate a refspec down to > submodules when the '--recurse-submodules' flag is given. The only refspecs > that are allowed to be propagated are ones which name a ref which exists > in both the superproject and the submodule, with the caveat that 'HEAD' > was disallowed. > > This patch teaches push-check (the submodule helper which determines if > a refspec can be propagated to a submodule) to permit propagating 'HEAD' > if and only if the superproject and the submodule both have the same > named branch checked out and the submodule is not in a detached head > state. cont'd: We need this use case because Gerrit's documentation ingrains this workflow in its users to use git push <remote> HEAD:refs/for/<target-branch> And when both the submodule as well as the superproject are still on a branch with the same name (and not detached) we'd not be misunderstood by the user on the syntax. More on the code later.