[git-reparent-branch] Keep empty branches when doing rebase-update.

This fixes a bit of awkward UX where you create a new branch and
immediately want to reparent it.

Previously:

```
$ git new-branch something
$ # Oops, I really wanted that to be based on other_branch
$ git reparent-branch other_branch
Reparenting something to track remove_urllib3_hack (was origin/main)
Rebasing: something
Deleted branch something (was e10e74d5).
'something' was merged with its parent, checking out 'origin/main' instead.
```

R=gavinmak@google.com

Change-Id: I60cd4da4798094476d47ff684f301bbdee1293b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4680281
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
changes/81/4680281/2
Robert Iannucci 2 years ago committed by LUCI CQ
parent 018e46c03d
commit 7c59d27873

@ -92,7 +92,7 @@ def main(args):
for branch, parent in topo_iter(branch_tree):
if parent in branches:
branches.append(branch)
return git_rebase_update.main(['--no-fetch'] + branches)
return git_rebase_update.main(['--no-fetch', '--keep-empty'] + branches)
if __name__ == '__main__': # pragma: no cover

Loading…
Cancel
Save