Skip to content

clone doesn't work if path exists locally #5982

@boretrk

Description

@boretrk

When cloning a repository libgit2 tests the given url against the filesystem to determine if a local clone should be done.
If the url also resolves to a path that exists locally then the clone fails.

Reproduction steps

mkdir -p "git:/github.com/libgit2/TestGitRepository"
lg2 clone git://github.com/libgit2/TestGitRepository TestGitRepository

Expected behavior

git clone git://github.com/libgit2/TestGitRepository TestGitRepository
Cloning into 'TestGitRepository'...
remote: Enumerating objects: 70, done.
remote: Total 70 (delta 0), reused 0 (delta 0), pack-reused 70
Receiving objects: 100% (70/70), 5.93 KiB | 2.96 MiB/s, done.
Resolving deltas: 100% (3/3), done.'

Actual behavior

lg2 clone git://github.com/libgit2/TestGitRepository TestGitRepository

ERROR 6: could not find repository from 'git:/github.com/libgit2/TestGitRepository'
Bad news:
 could not find repository from 'git:/github.com/libgit2/TestGitRepository'

Version of libgit2 (release number or SHA1)

631ae5a

Operating system(s) tested

Linux Mint 20.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions