Skip to content

git archive of a subdirectory of the repo does not include LFS files (you get pointers instead) #5343

@gknispel-australdx

Description

@gknispel-australdx

Describe the bug

If I archive with e.g. git archive --prefix=repro/ -o ../repro.tgz HEAD or even git archive --prefix=repro/ -o ../repro.tgz HEAD src/ the lfs files are properly included in the archive.

However, if I archive with e.g. git archive --prefix=repro/ -o ../repro.tgz HEAD:src (which does not have the same effect as git archive --prefix=repro/ -o ../repro.tgz HEAD src/ ; the HEAD:src param will strip the src/ prefix in all paths of the archive, while HEAD src/ will select src/ but not strip the src/ prefix from the paths)

To Reproduce
Steps to reproduce the behavior:

  1. Clone a repository which contains LFS files.
  2. Create an archive by selecting a sub root for what to put in it with a syntax like HEAD:src
  3. Unpack the archive elsewhere
  4. The LFS files are replaces by their pointers

Expected behavior
I expected to get the actual content for the archive LFS files, and not their pointers.

System environment
Tested on Ubuntu 20.04 and Debian 11.

Output of git lfs env

git-lfs/2.13.2 (GitHub; linux amd64; go 1.15.9)
git version 2.30.2

Endpoint=https://gitlab.com/australdx/private/repro.git/info/lfs (auth=none)
  [email protected]:australdx/private/repro.git
LocalWorkingDir=/home/user/git/repro
LocalGitDir=/home/user/git/repro/.git
LocalGitStorageDir=/home/user/git/repro/.git
LocalMediaDir=/home/user/git/repro/.git/lfs/objects
LocalReferenceDirs=
TempDir=/home/user/git/repro/.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/user/git/repro/.git/lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic,lfs-standalone-file
UploadTransfers=basic,lfs-standalone-file
GIT_EXEC_PATH=/usr/lib/git-core
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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions