Skip to content

Commit 7cc3251

Browse files
authored
[IMP] vcs/git: Downgrade warning when git clone on ref (#12282)
The warning is inconsistent as pip will not warn when cloning a branch or tag which are mutable anyway.
1 parent da3aca3 commit 7cc3251

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

news/12283.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove warning when cloning from a Git reference that does not look like a commit hash.

src/pip/_internal/vcs/git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def resolve_revision(
236236
# Do not show a warning for the common case of something that has
237237
# the form of a Git commit hash.
238238
if not looks_like_hash(rev):
239-
logger.warning(
239+
logger.info(
240240
"Did not find branch or tag '%s', assuming revision or ref.",
241241
rev,
242242
)

tests/unit/test_vcs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import logging
34
import os
45
import pathlib
56
from typing import Any
@@ -271,6 +272,7 @@ def test_git_resolve_revision_rev_not_found(get_sha_mock: mock.Mock) -> None:
271272
def test_git_resolve_revision_not_found_warning(
272273
get_sha_mock: mock.Mock, caplog: pytest.LogCaptureFixture
273274
) -> None:
275+
caplog.set_level(logging.INFO)
274276
get_sha_mock.return_value = (None, False)
275277
url = HiddenText("git+https://git.example.com", redacted="*")
276278
sha = 40 * "a"

0 commit comments

Comments
 (0)