bookmarks: do not auto clean remote names in git repos

Summary:
Git tags are translated to remotenames. Auto clean could cause trouble.
Therefore disable auto clean for git repos.

Reviewed By: DurhamG

Differential Revision: D33237333

fbshipit-source-id: 2e857899e122803c4bad03280827f59858826fde
This commit is contained in:
Jun Wu 2021-12-21 12:35:00 -08:00 committed by Facebook GitHub Bot
parent 6ec121ebc8
commit 3d1a726c3f

View File

@ -21,6 +21,7 @@ import bindings
from . import (
encoding,
error,
git,
lock as lockmod,
mutation,
pycompat,
@ -1168,7 +1169,9 @@ class lazyremotenamedict(pycompat.Mapping):
alias_default = repo.ui.configbool("remotenames", "alias.default")
entries = list(readremotenames(repo))
threshold = repo.ui.configint("remotenames", "autocleanupthreshold") or 0
if threshold > 0 and len(entries) > threshold:
# Do not clean up refs for git, which might have a lot of refs.
# Doing so causes surprises: tags, remote refs will be gone unexpectedly.
if not git.isgit(repo) and threshold > 0 and len(entries) > threshold:
repo.ui.status_err(
_(
"attempt to clean up remote bookmarks since they exceed threshold %s\n"