Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert zero length file #21

Closed
kna opened this issue Oct 14, 2016 · 3 comments
Closed

Convert zero length file #21

kna opened this issue Oct 14, 2016 · 3 comments

Comments

@kna
Copy link

kna commented Oct 14, 2016

git lfs command does not convert zero length file to a pointer file
ref. https://github.com/github/git-lfs/blob/cd68f26c103b9ad474bd569c98a5e490e696b544/test/test-zero-len-file.sh#L37

But, git-lfs-migrate(v0.2.2) converts it.

$ mkdir git-lfs-migrate-test
$ cd git-lfs-migrate-test/
$ git init
$ touch empty.dat
$ git add empty.dat
$ git commit -m 'add files'
$ cd ..

$ git clone --mirror git-lfs-migrate-test git-lfs-migrate-test.git
$ java -jar git-lfs-migrate.jar \
     -s git-lfs-migrate-test.git \
     -d git-lfs-migrate-test-converted.git \
     "*.dat"
$ cd git-lfs-migrate-test-converted.git
$ git log -p | grep empty.dat -A 10
diff --git a/empty.dat b/empty.dat
new file mode 100644
index 0000000..fc8e42b
--- /dev/null
+++ b/empty.dat
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
+size 0

When I push it to github, I can't clone it.

$ git lfs clone https://github.com/kna/git-lfs-migrate-test-converted
Cloning into 'git-lfs-migrate-test-converted'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 4 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
Checking connectivity... done.
Git LFS: (1 of 1 files) 0 B / 0 B                                                                                                                                     Skipped checkout for empty.dat, content not local. Use fetch to download.

Errors logged to /tmp/git-lfs-migrate-test-converted/.git/lfs/objects/logs/20161014T121953.084344008.log
Use `git lfs logs last` to view the log.


$ cat /tmp/git-lfs-migrate-test-converted/.git/lfs/objects/logs/20161014T121953.084344008.log
git-lfs/1.4.2 (GitHub; linux amd64; go 1.7)
git version 1.9.1

$ git-lfs clone https://github.com/kna/git-lfs-migrate-test-converted
Skipped checkout for empty.dat, content not local. Use fetch to download.

smudge: Error
github.com/github/git-lfs/errors.newWrappedError
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/errors/types.go:166
github.com/github/git-lfs/errors.NewDownloadDeclinedError
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/errors/types.go:317
github.com/github/git-lfs/lfs.PointerSmudge
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/lfs/pointer_smudge.go:62
github.com/github/git-lfs/lfs.PointerSmudgeToFile
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/lfs/pointer_smudge.go:27
github.com/github/git-lfs/commands.checkoutWithChan
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/commands/command_checkout.go:194
github.com/github/git-lfs/commands.checkoutFromFetchChan.func1
        /tmp/docker_run/src/github.com/github/git-lfs/amd64/obj-x86_64-linux-gnu/src/github.com/github/git-lfs/commands/command_checkout.go:70
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:2086

ENV:
LocalWorkingDir=/tmp/git-lfs-migrate-test-converted
LocalGitDir=/tmp/git-lfs-migrate-test-converted/.git
LocalGitStorageDir=/tmp/git-lfs-migrate-test-converted/.git
LocalMediaDir=/tmp/git-lfs-migrate-test-converted/.git/lfs/objects
LocalReferenceDir=
TempDir=/tmp/git-lfs-migrate-test-converted/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
BatchTransfer=true
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic

git-lfs-migrate should not convert zero length file to a pointer file.

@kna
Copy link
Author

kna commented Oct 14, 2016

I created the pull-request to fix this issue -> #22

@bozaro bozaro closed this as completed in b98d49d Oct 14, 2016
@bozaro
Copy link
Owner

bozaro commented Oct 14, 2016

Thanks a lot. This issue is now fixed in 0.2.3 version.

@kna
Copy link
Author

kna commented Oct 14, 2016

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants