project: unify StartBranch flows behind git-update-ref

We're using this for git worktrees because it handles the .git file
format, but it should work for all flows.  Unify to simplify.  This
also fixes the worktree logic which duplicated .git/config settings.

Change-Id: Ie3af2e206710859dccfc376b3593f415d6830738
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256034
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: Jonathan Nieder <jrn@google.com>
diff --git a/project.py b/project.py
index a5d35bf..2112ee3 100644
--- a/project.py
+++ b/project.py
@@ -1994,19 +1994,11 @@
       except KeyError:
         head = None
     if revid and head and revid == head:
-      if self.use_git_worktrees:
-        self.work_git.update_ref(HEAD, revid)
-        branch.Save()
-      else:
-        ref = os.path.join(self.gitdir, R_HEADS + name)
-        try:
-          os.makedirs(os.path.dirname(ref))
-        except OSError:
-          pass
-        _lwrite(ref, '%s\n' % revid)
-        _lwrite(self.GetHeadPath(), 'ref: %s%s\n' % (R_HEADS, name))
-        branch.Save()
-        return True
+      ref = R_HEADS + name
+      self.work_git.update_ref(ref, revid)
+      self.work_git.symbolic_ref(HEAD, ref)
+      branch.Save()
+      return True
 
     if GitCommand(self,
                   ['checkout', '-b', branch.name, revid],