Avoid shallow fetches to ADO remotes

This commit is contained in:
Avram Lubkin 2023-07-17 14:10:06 -04:00 коммит произвёл Avram Lubkin
Родитель 406fda90e6
Коммит a5e4252984
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

@ -8,6 +8,7 @@ import logging
import pathlib
import re
from typing import Any, Iterable, List, Optional, Set, Tuple
from urllib.parse import urlparse
import git
@ -157,13 +158,17 @@ class Repo:
remote_sha = output.split()[0]
# No fetch window specified
if not since:
# Or using Azure DevOps since it doesn't support shallow-since or unshallow
if not since or any(
urlparse(url).hostname == "msazure.visualstudio.com" for url in remote.urls
):
LOGGER.info("Fetching ref %s from remote %s", remote_ref, remote)
remote.fetch(remote_ref, **kwargs)
# Create tag at FETCH_HEAD to preserve reference locally
if local_sha is None or local_sha != remote_sha:
self.obj.create_tag(local_ref, "FETCH_HEAD", force=True)
return
# If we have the ref locally, see if the ref is the same to avoid resetting depth

Просмотреть файл

@ -165,7 +165,7 @@ spelling-ignore-words = [
"parsers", "PatchData", "preprocessing",
"repo", "repos",
"setuptools", "SHA", "subclassed", "subcommand", "subcommands", "subparsers",
"untracked",
"unshallow", "untracked",
"virtualenv",
]