Only chdir in rebase-update if there's a directory to go back to.

TBR=agable@chromium.org
BUG=499031

Review URL: https://codereview.chromium.org/1182713002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295642 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_rebase_update.py b/git_rebase_update.py
index 63d0503..f98b8b2 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -271,7 +271,8 @@
           % (return_branch, root_branch)
         )
       git.run('checkout', root_branch)
-    os.chdir(return_workdir)
+    if return_workdir:
+      os.chdir(return_workdir)
     git.set_config(STARTING_BRANCH_KEY, '')
     git.set_config(STARTING_WORKDIR_KEY, '')