mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
git: normalize reference during unbundle
Summary: Certain git bundles might contain references like "BUNDLE_HEAD" that would be ignored by usual paths. Normalize them to visibleheads refs. Differential Revision: D33968793 fbshipit-source-id: a3d6fc1a7d73328cddf0ebddfe7b7a021d929528
This commit is contained in:
parent
1582804af2
commit
c4334d4e7b
@ -375,8 +375,17 @@ def _writevisibleheadrefs(repo, nodes):
|
||||
|
||||
|
||||
def _writerefs(repo, refnodes):
|
||||
"""write git references. refnodes is a list of (ref, node)."""
|
||||
"""write git references. refnodes is a list of (ref, node).
|
||||
|
||||
Only 'refs/heads/<name>' references are written (as local bookmarks).
|
||||
Other references will be normalized to `refs/visibleheads/<hex>`.
|
||||
"""
|
||||
for (ref, node) in refnodes:
|
||||
ref = str(ref)
|
||||
if not ref.startswith("refs/heads/"):
|
||||
# ref might be non-standard like "BUNDLE_HEAD".
|
||||
# normalize it to a visiblehead ref.
|
||||
ref = str(RefName.visiblehead(node))
|
||||
callgit(repo, ["update-ref", str(ref), hex(node)])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user