Skip to content

git lfs is not supported #1973

Open
Open

Description

@tapika

Commands.Stage & repo.Commit does not preserve LFS files at all, even if LFS is enabled.

Also if you try to read from git history using API like:

Blob blob = repo0.Lookup<Blob>(change.Oid);
using (Stream stream = blob.GetContentStream());
...

Instead of file - you will read pointer file instead -
https://github.com/git-lfs/git-lfs/blob/main/docs/spec.md

text file.

Would be nice if LFS would be supported in libgit2sharp library.

Activity

  1. dsynclabsllc commented on Mar 14, 2023

    @dsynclabsllc

    I concur. This is very disappointing. This should just work with some easily configured control.

  2. lucianm commented on Jul 22, 2024

    @lucianm

    Although LibGit2Sharp provides the means of easily supporting a feature like LFS which is using filters, as someone not really familiar with the LibGit2Sharp code and architecture, I cannot really see where the (possibly many) places in the code would be to register such a LFS filter. However, as I'm interested in a particular LibGit2Sharp-based application becoming LFS-aware, that's a different story, as it has a clear entry point for running a command or workflow, and then some sort of shutdown. I'm talking about git-tfs, which I managed to make LFS-aware with the help of the discussions and code found in #1236 . I added such a filter I found in a gist linked in the mentioned issue to my git-tfs fork, thankfully the entire actual LFS support is implemented in the filter, which could actually be contributed to LibGit2Sharp instead of git-tfs, as it's generic and other applications might make use of it if needed, as well, it's like I said, just a matter of registering the filter at startup and de-registering it on shutting down.

    That implementation works well for me from the command line under Windows 10, I'm only having some issues when I use the same commands in git-extensions, but that might be another story. Git-LFS is automatically being installed by the filter due to the git lfs command itself (which it is spawning) whenever .gitattributes entries would trigger the filter (it does so for example when I'm cloning a testing branch from TFS, in which I checked in a .gitattributes file tracking some binary files in LFS as the very first chnageset, followed by others containing such binaries, and it also does the correct cleaning or smudging when git-tfs would synchronize between TFS changesets and git commits.

    What do LibGit2Sharp developers think of it, can the filter be made available to a broader program base by including it?
    Is there an "easy" way to provide this filter "readily" registered for any application using LibGit2Sharp transparently (which I do not really think)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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