chrome_committer: use HEAD to resolve default branch

We don't need to hardcode HEAD when git will resolve the default for us.

BUG=chromium:1126855
TEST=CQ passes

Change-Id: I3d6755318011880375d987d2c2f04e1dd3e45864
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2702072
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Sean McAllister <smcallis@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Sean McAllister <smcallis@google.com>
diff --git a/lib/chrome_committer.py b/lib/chrome_committer.py
index abf9ad6..c2eaee9 100644
--- a/lib/chrome_committer.py
+++ b/lib/chrome_committer.py
@@ -63,8 +63,7 @@
     sparse_checkout += ['codereview.settings', 'WATCHLISTS']
     git.ShallowFetch(self._checkout_dir, constants.CHROMIUM_GOB_URL,
                      sparse_checkout=sparse_checkout)
-    git.CreateBranch(self._checkout_dir, 'auto-commit-branch',
-                     branch_point='origin/master')
+    git.CreateBranch(self._checkout_dir, 'auto-commit-branch')
 
   def Commit(self, file_paths, commit_msg):
     """Commits files listed in |file_paths|.
diff --git a/lib/chrome_committer_unittest.py b/lib/chrome_committer_unittest.py
index ddc6e1e..2c0fe6a 100644
--- a/lib/chrome_committer_unittest.py
+++ b/lib/chrome_committer_unittest.py
@@ -44,8 +44,8 @@
                         'https://chromium.googlesource.com/chromium/src.git')
     self._assertCommand('git config core.sparsecheckout true')
     self._assertCommand('git fetch --depth=1')
-    self._assertCommand('git pull origin master')
-    self._assertCommand('git checkout -B auto-commit-branch origin/master')
+    self._assertCommand('git pull origin HEAD')
+    self._assertCommand('git checkout -B auto-commit-branch HEAD')
     self.assertEqual(
         osutils.ReadFile(os.path.join(self.tempdir, '.git', 'info',
                                       'sparse-checkout')),
diff --git a/lib/git.py b/lib/git.py
index c4660ce..887e068 100644
--- a/lib/git.py
+++ b/lib/git.py
@@ -826,7 +826,7 @@
   RunGit(git_repo, ['fetch', '--depth=1'],
          print_cmd=True, stderr=True, capture_output=False)
   # Pull the files in sparse_checkout.
-  RunGit(git_repo, ['pull', 'origin', 'master'],
+  RunGit(git_repo, ['pull', 'origin', 'HEAD'],
          print_cmd=True, stderr=True, capture_output=False)
   logging.info('ShallowFetch completed in %s.', utcnow() - start)
 
diff --git a/lib/git_unittest.py b/lib/git_unittest.py
index 5d3cf16..dc4f73a 100644
--- a/lib/git_unittest.py
+++ b/lib/git_unittest.py
@@ -101,7 +101,7 @@
     self.assertCommandContains(['config', 'core.sparsecheckout', 'true'])
     self.assertCommandContains(['remote', 'add', 'origin', url])
     self.assertCommandContains(['fetch', '--depth=1'])
-    self.assertCommandContains(['pull', 'origin', 'master'])
+    self.assertCommandContains(['pull', 'origin', 'HEAD'])
     self.assertEqual(osutils.ReadFile(sparse_checkout),
                      'dir1/file1\ndir2/file2')