dirk-thomas / vcstool

Vcstool is a command line tool designed to make working with multiple repositories easier
Apache License 2.0
412 stars 88 forks source link

vcs-import with git-repository that requires git-lfs fails in weird way (if git-lfs is not installed) #237

Open jenisys opened 2 years ago

jenisys commented 2 years ago

VERSION: vcstool 0.3.0 PRECONDITION: git-lfs is not installed

Using vcstool to import a .repos file with https://github.com/pdm-project/pdm.git fails in a weird way (if git-lfs is not installed). This repository requires git-lfs (which not installed initially). vcs import fails in a weird way that does not hint (at least for me), what the root cause of this problem is. After I understood what the problem was, I installed git-lfs and everything was fine.

DESIRED CHANGE: Better description/diagnostics what goes wrong if vcs import is used in this case.

HOW TO REPEAT:

$ vcs import --input=.repos 
=== ./pdm (git) ===
Could not clone repository 'https://github.com/pdm-project/pdm.git': fatal: destination path '.' already exists and is not an empty directory.

# -- CLEANUP and RETRY: With option --debug
$ rm -rf pdm/
$ vcs import --input=.repos --debug
DEBUG:vcstool.executor:started './pdm'
DEBUG:vcstool.executor:ongoing ['./pdm']
DEBUG:vcstool.executor:finished './pdm'
=== ./pdm (git) ===
Could not checkout ref 'main': error: The following untracked working tree files would be overwritten by checkout:
    .gitattributes
    .github/ISSUE_TEMPLATE/bug_report.md
    .github/ISSUE_TEMPLATE/feature_request.md
    .github/PULL_REQUEST_TEMPLATE.md
    .github/workflows/benchmark.yml
    .github/workflows/ci.yml
    .github/workflows/doc.yml
    .github/workflows/release.yml
    .gitignore
...

$ git clone https://github.com/pdm-project/pdm.git pdm_2
Cloning into 'pdm_2'...
remote: Enumerating objects: 15958, done.
remote: Counting objects: 100% (5546/5546), done.
remote: Compressing objects: 100% (1959/1959), done.
remote: Total 15958 (delta 3425), reused 5092 (delta 3106), pack-reused 10412
Receiving objects: 100% (15958/15958), 8.38 MiB | 6.47 MiB/s, done.
Resolving deltas: 100% (10107/10107), done.
git-lfs filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

ASSETS:

# -- FILE: .repos
repositories:
  pdm:
    type: git
    url: https://github.com/pdm-project/pdm.git