Page MenuHomePhorge

arc land when using submodules with squash strategy does not like the submodule.recurse git option
Open, Needs TriagePublic

Description

A user here had the submodule.recurse git config option set globally. He then made a branch containing a commit consisting solely of a submodule bump and landed it and was surprised to find that, during the land process, his change was dropped entirely.

I verified this myself with the following:

  1. Create an empty repo containing only a single submodule, initially pointed at sha X
  2. git config --global submodule.recurse true
  3. Create a branch which changes the commit for that submodule from X to Y, run it through arc diff
  4. Run arc land
  5. Observe that HEAD is a completely empty commit and the submodule is pointing back at X

It appears that the problem is when arc checks out the base branch in order to merge the rebased branch back in; with submodule.update set, this resets the submodule state.

After running git merge --no-stat --no-commit --ff --squash -- <rebased sha>, the submodule path is dirty and the subsequent git commit ends up resetting the submodule back to what it was in the base url.

P4 is a hacky patch that I applied to arcanist which fixes the problem.

In general, I think we probably ought to explicitly reset all git options that significantly change git's behavior....

Related Objects