pip understand @# as empty tag/href in git source and breaks installation · Issue #7402 · pypa/pip (original) (raw)

Environment

Description

When a git url contains a '@#' becomes an empty tag or href, that does not match with any fetched refs or tags and produces a : " fatal: ambiguous argument '': unknown revision or path not in the working tree."

When running into requirements.txt, breaks installation at this repo point

Expected behavior

Ignore the empty tag/href and continues

How to Reproduce

  1. Setup requirements.txt with a source having a '@#' . e.g:
    -e git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg
  2. Then run 'pip install -r requirements.txt'. Installations works
  3. Then run install again and you get the error ... an error occurs
    fatal: ambiguous argument '': unknown revision or path not in the working tree.
cat requirements.txt 
-e git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg

(j2f) jorge@debian:~/projects/personal/j2f $ pip install -r requirements.txt 
Obtaining py_pkg from git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg (from -r requirements.txt (line 1))
  Cloning https://github.com/AlexIoannides/py-package-template.git to /home/jorge/.virtualenvs/j2f/src/py-pkg
  Running command git clone -q https://github.com/AlexIoannides/py-package-template.git /home/jorge/.virtualenvs/j2f/src/py-pkg
  WARNING: Generating metadata for package py-pkg produced metadata for project name py-package-template. Fix your #egg=py-pkg fragments.
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/9b/af/4fc72f9d38e43b092e91e5b8cb9956d25b2e3ff8c75aed95df5569e4734e/numpy-1.17.4-cp37-cp37m-manylinux1_x86_64.whl (20.0MB)
     |████████████████████████████████| 20.0MB 6.6MB/s 
Collecting requests
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached https://files.pythonhosted.org/packages/b4/40/a9837291310ee1ccc242ceb6ebfd9eb21539649f193a7c8c86ba15b98539/urllib3-1.25.7-py2.py3-none-any.whl
Collecting certifi>=2017.4.17
  Using cached https://files.pythonhosted.org/packages/18/b0/8146a4f8dd402f60744fa380bc73ca47303cccf8b9190fd16a827281eac2/certifi-2019.9.11-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: numpy, idna, urllib3, certifi, chardet, requests, py-package-template
  Running setup.py develop for py-package-template
Successfully installed certifi-2019.9.11 chardet-3.0.4 idna-2.8 numpy-1.17.4 py-package-template requests-2.22.0 urllib3-1.25.7

(j2f) jorge@debian:~/projects/personal/j2f $ pip install -r requirements.txt 
Obtaining py_pkg from git+https://github.com/AlexIoannides/py-package-template.git@#egg=py_pkg (from -r requirements.txt (line 1))
  Updating /home/jorge/.virtualenvs/j2f/src/py-pkg clone
  Running command git fetch -q --tags
  WARNING: Did not find branch or tag '', assuming revision or ref.
  Running command git reset --hard -q ''
  fatal: ambiguous argument '': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions, like this:
  'git <command> [<revision>...] -- [<file>...]'
ERROR: Command errored out with exit status 128: git reset --hard -q '' Check the logs for full command output.