• sdefresne@chromium.org's avatar
    Fix "git rebase-update" when multiple branch are stale. · d421f6a4
    sdefresne@chromium.org authored
    Fix a bug that left branches tracking a dead branch if both their parent
    and grand-parent were left with no changes after a "rebase-update" step.
    
    Given the following initial state:
      $ git map-branches -v
      origin/master
        a
          b
            c *        [ ahead 1 ]
    
    without this patch, a "git rebase-update" on this tree state would
    leave the branch "c" as tracking a non-existing branch "a":
    
      $ git recursive-rebase
      a up-to-date
      b up-to-date
      c up-to-date
      Reparented c to track a (was tracking b)
      Deleted branch b (was 448d1da).
      Deleted branch a (was 448d1da).
      $ git map-branches -v
      {a:GONE}
        c *
    
    with the patch, we record that the branch "c" is tracking must be
    updated twice and we end up in a state were "c" is correctly tracking
    "origin/master":
    
      $ git recursive-rebase
      a up-to-date
      b up-to-date
      c up-to-date
      Reparented c to track origin/master (was tracking b)
      Deleted branch b (was 448d1da).
      Deleted branch a (was 448d1da).
      $ git map-branches -v
      origin/master
        c *            [ ahead 1 ]
    
    BUG=456806
    
    Review URL: https://codereview.chromium.org/1482753002
    
    git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297792 0039d316-1c4b-4281-b951-d872f2087c98
    d421f6a4
git_rebase_update.py 11 KB