Error out of rebase-update if there are uncommitted changes
Currently, running rebase-update may lead to missing untracked files.
This change prints an error instead freezing and thawing local changes.
Bug: 1251047
Change-Id: Ia5f718ed957dae936d2ead2778760ae0c8d9f9ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3171828
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
diff --git a/git_rebase_update.py b/git_rebase_update.py
index 716111e..912004b 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -256,12 +256,9 @@
return_branch, return_workdir = find_return_branch_workdir()
os.chdir(git.run('rev-parse', '--show-toplevel'))
- if git.current_branch() == 'HEAD':
- if git.run('status', '--porcelain'):
- print('Cannot rebase-update with detached head + uncommitted changes.')
- return 1
- else:
- git.freeze() # just in case there are any local changes.
+ if git.run('status', '--porcelain'):
+ print('Cannot rebase-update with uncommitted changes.')
+ return 1
branches_to_rebase = set(opts.branches)
if opts.current:
@@ -322,7 +319,6 @@
# return_branch may not be there any more.
if return_branch in git.branches():
git.run('checkout', return_branch)
- git.thaw()
else:
root_branch = git.root()
if return_branch != 'HEAD':