-
Notifications
You must be signed in to change notification settings - Fork 24
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
Adding basic LFS support #62
base: master
Are you sure you want to change the base?
Conversation
Hi, thanks for your contribution. I have zero experience with Git LFS, only a basic idea what it does...so a few questions: You wrote that Would the call throw an exception? If not, it would be nice if SCM Backup could detect this somehow and warn the user. Any idea if that's possible? |
Thanks for the reply. I thought about this... Let's say we only want to backup LFS files (with
On Windows
In the end it could all look something like this inside the
This works fine for repos without any LFS files (having an empty LFS file list). One short fix for me was to make the following change in the
For this:
This made a large list of LFS files as response possible and no deadlock occured. But maybe it causes other issues since it modifies the Thanks for taking the time. |
Thanks for the extensive write-up. Sorry for taking so long to answer, but spare time is a precious good at the moment :-/ In general:
I'd like to have methods in
Thanks for contributing! |
In commit 5323b32 I have added these three methods to the files
I executed them inside
I am not experienced with testing at all, hence I left it out completely. The idea to have LFS enabled via config is brilliant. |
Thank you for the work so far! No problem, I can create the tests. I created this test repo with two large files: ...by doing this:
(source: https://stackoverflow.com/a/986041/6884)
The most basic test for your changes would be cloning this repo with SCM Backup, and verifying that the two large files are actually in the working directory. But I tested it with the old version of SCM Backup (without your changes) as well. As far as I understand it, the actual large files should be missing in the backup, but there should be some "pointer files" instead. SCM Backup creates a bare repo when backing up...so to view its content, I need to clone it again.
After that, the LFS files are missing in the working directory, but there are no pointer files either. So, did I do anything wrong? |
I wrote this:
--> In the meantime, I merged that branch into master. There's now a It's still empty in master, but I have more changes in the making in another branch, where you can see how it's intended to be used: You can copy & paste the And then you can create a new section in the config:
...and get the value from the config like this:
|
merging current scm-backup/master 738f3f0 into lfs-support
Sorry for the delay. I tried a lot of stuff. Concerning the options file I merged your current master into this lfs-support fork and added the This current code in GitScm.cs is
In the end, it should work like this?
Is this the best approach? How do I use/access the Concerning the LFS test repo and files
Yes and No :) The mentioned error (Smudge error: Error downloading) will be shown when scm-backup creates a backup of a repo including LFS files and the user tries to make a local clone of the backup to restore files. Despite the error and the pointer files not being there in the file system after cloning, you can see the pointer files are included in the commit:
For completeness, this is how one can view the desired files you created, cloning directly from a live bare repo: Clone to get real LFS files:
Clone to get pointer files only:
LFS is not used to the scm-backup procedure with creating a bare clone. Fully restoring a "BackupRepo" created by scm-backup which includes LFS files:
To be fair, I was confused a lot after cloning a repo for the tenth time... I hope these explanations are correct and somehow comprehensible :) |
No problem, you see that my delays are at least as long as yours. At the moment my time is very limited :-( For a start, here are my answers to "Concerning the options file“:
Yes, looks good. If someone explicitly enabled it in the config, IMO it should visibly fail when LFS is missing on their machine. But I would prefer failing earlier...so that SCM Backup wouldn’t even start to backup. This is called from the In an ideal world, the call to the hoster's API (which happens before) would return the information per repo if it contains LFS files. If we had that, we could only do the check when there's actually a repo that contains LFS files, but at first glance not every hoster's API supports this. Gitlab has a So I think the only viable solution is adding code in Later, when we are sure that the "experimental" LFS support works, we will probably just set the config value to true by default...so people who get the "LFS not installed" warning can just disable it if they are sure they don't need it.
The whole configuration is part of the So you can access it via The next thing I'll try to do is adding some tests for backing up the LFS test repo. |
I'm not sure if GitHub has a better way to contribute to a fork of my own repository. https://github.com/christianspecht/scm-backup-lfs For now, I fixed the tests. |
Guys, thanks for all the work you are doing! Any news when LFS support will be available? |
@ItayHershko: I don't know when it will be available. @evolu1: I pushed some more changes to https://github.com/christianspecht/scm-backup-lfs, but so far I wasn't able to actually restore the large file. There's now a test which is supposed to verify that the backup actually contains the large file (using the steps you listed), but the last clone action ("NewRepo" to final repo) fails with this error:
The log file mentioned in the message is here: To make sure the problem is not somehow caused by the fact that I'm calling the Git command line from C# code, I tried to do the same steps in a Windows batch file:
But this fails already in the
Does this work on your machine? |
Is LFS support included in the latest release version? |
Concerning issue #21
Basic solution to backup a repository including the real LFS files (and not just the pointer files).
I would love to see LFS support implemented.
It's my first contribution to a bigger repository. I'm happy to improve this pull request.