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

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.


Just like in git, the '-' indicates that the file has been deleted in the working directory. The two files with '-' had indeed been inadvertently deleted. Restoring them brought back the '*'.

What threw me off was that git lfs status reported nothing, but I guess I'm interpreting it wrong.


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.

Tags:

Git

Git Lfs