mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-07-09 08:29:02 +00:00
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>
This commit is contained in:
18
project.py
18
project.py
@ -1994,19 +1994,11 @@ class Project(object):
|
||||
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],
|
||||
|
Reference in New Issue
Block a user