summaryrefslogtreecommitdiffstats
path: root/pager.py
diff options
context:
space:
mode:
authorRemy Böhmer <oss@bohmer.net>2020-12-15 18:49:02 +0100
committerMike Frysinger <vapier@google.com>2020-12-26 07:30:40 +0000
commit1469c28ec3e221cf08a9f83a415945443eac0be4 (patch)
tree43308c66eae2beac5858ece2fe90dcfb5e5abb9e /pager.py
parent8add62325dbe4df60cde1af6b093d99e79685140 (diff)
downloadgit-repo-1469c28ec3e221cf08a9f83a415945443eac0be4.tar.gz
project: detach HEAD in internal worktree checkout.
When checkout is done with Git worktrees then the HEAD in the bare-git repositories point to the initialized default (e.g. 'refs/heads/master'). This default branch does not exist locally and is not automatically created. When a user now creates a branch in any git repository named 'master' then it is no longer possible to get rid of this branch, neither is it possible to switch to another branch and switch back to this master branch. Git concludes the 'master' branch is already checked out (in the bare Git) and that results in a lockdown of this master branch. To repoduce this issue, run these commands in a repo tree checked out with --worktree: - git checkout master # assuming the remote repo has a master branch, # a local tracking branch master is created here - git checkout -b temp - git checkout master # This one now fails - git branch -d master # fails too The failure is caused by Git assuming the master branch is checked out by the bare git repository since HEAD is pointing towards it. To workaround this, we always detach HEAD in the bare-git when syncing. We don't need it to point to a ref in general, but we would like it to be valid so git tools "just work" if they're run in here. Signed-off-by: Remy Bohmer <oss@bohmer.net> Change-Id: I15c96604363c41f0d01c42f533174393097daeb5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/290985 Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'pager.py')
0 files changed, 0 insertions, 0 deletions