Skip to content

cloning local repo with trailing slash fails #5400

@ebardsley

Description

@ebardsley

Describe the bug

For a given local repo with LFS, git clone /path/to/repo succeeds, but git clone /path/to/repo/ fails.

To Reproduce

~/git$ git init --bare repo.git
Initialized empty Git repository in /home/ed/git/repo.git/
~/git$ git init test
Initialized empty Git repository in /home/ed/git/test/.git/
~/git$ cd test
~/git/test$ cp /usr/bin/bash .
~/git/test$ git lfs track bash
Tracking "bash"
~/git/test$ git commit -a -m "initial commit"
~/git/test$ git remote add origin $PWD/../repo.git
~/git/test$ git push origin main
Uploading LFS objects: 100% (1/1), 0 B | 0 B/s, done.
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 407 bytes | 407.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
To /home/ed/git/test/../repo.git
 * [new branch]      main -> main

# This works.
~/git$ git clone $PWD/repo.git new2
Cloning into 'new2'...
done.

# This should work, but fails to fetch LFS objects.
~/git$ git clone $PWD/repo.git/ new3
Cloning into 'new3'...
done.
Downloading bash (1.4 MB)
Error downloading object: bash (2c336c6): Smudge error: Error downloading bash (2c336c63e26881d2f02f34379024e7c314bce572c08cbaa319bacbbec29f93ed): batch request: missing protocol: "/home/ed/git/repo.git/info/lfs"

Errors logged to '/home/ed/git/new3/.git/lfs/logs/20230621T004858.750834098.log'.
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: bash: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

~/git$

Expected behavior

This should mimic git's behavior for local paths and treat them both identically.

System environment

Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy

Output of git lfs env

git-lfs/3.3.0 (GitHub; linux amd64; go 1.19.3)
git version 2.41.0

Endpoint=file:///home/ed/git/repo.git (auth=none)
LocalWorkingDir=/home/ed/git/test3
LocalGitDir=/home/ed/git/test3/.git
LocalGitStorageDir=/home/ed/git/test3/.git
LocalMediaDir=/home/ed/git/test3/.git/lfs/objects
LocalReferenceDirs=
TempDir=/home/ed/git/test3/.git/lfs/tmp
ConcurrentTransfers=8
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/home/ed/git/test3/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file,ssh
UploadTransfers=basic,lfs-standalone-file,ssh
GIT_EXEC_PATH=/usr/lib/git-core
GIT_TEMPLATE_DIR=/home/ed/.git_template
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

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