Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git lfs ls-files : Asterisk (*) vs. Dash (-)

Tags:

git

git-lfs

This is my listing of git lfs managed files

$ git lfs ls-files

b1d5dd29dd - file1.zip
27d3073f43 - file2.zip
fb4e699c05 * file3.zip

Why does one file have an asterisk/star (*) beside it, while the others have a dash (-) beside them?

The git lfs wiki seems to indicates that (*) is expected.

https://github.com/github/git-lfs/wiki/Tutorial

git lfs status shows all clear (nothing to be committed/pushed/staged).

like image 606
changingrainbows Avatar asked Apr 12 '16 22:04

changingrainbows


2 Answers

This page suggests:

An asterisk (*) after the OID indicates a LFS pointer, a minus (-) a full object.

But my experience has been the opposite.

For me, the minus (-) indicated a pointer and the asterisk (*) indicated the real large-file in git lfs.

like image 96
dzubke Avatar answered Nov 11 '22 15:11

dzubke


This wasn't documented in the ls-files man page, so I dug into the source code to find the answer.

func lsFilesMarker(p *lfs.WrappedPointer) string {
    info, err := os.Stat(p.Name)
    if err == nil && info.Size() == p.Size {
        return "*"
    }

    return "-"
}

* probably means the file on disk is the same size as the one in the repository or index, depends on what's in WrappedPointer.Size. It was added in this commit, but not explained. Either way, it seems like a poor test as the content can change but not the size.

Note that the - code path is never tested. You might wish to let them know about the lack of tests and docs.

like image 11
Schwern Avatar answered Nov 11 '22 15:11

Schwern