Re: [PATCH] submodule--helper: teach push-check to handle HEAD
- From
Stefan Beller <sbeller@google.com>
- Date
- Jun 23, 2017, 20:26 UTC
- Message-ID
- <CAGZ79kZqjaXSrqawgDnxu58sSPWVm8kAhRxn69Sbo8_aP4rr6w@mail.gmail.com>
- In-Reply-To
- <20170623200427.26803-1-bmwill@google.com>
On Fri, Jun 23, 2017 at 1:04 PM, Brandon Williams <bmwill@google.com> wrote:
Show 12 quoted lines
> 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.