Fix issue where git archive fails on repositories with Git LFS#8186
Fix issue where git archive fails on repositories with Git LFS#8186chadac wants to merge 2 commits intoNixOS:masterfrom
git archive fails on repositories with Git LFS#8186Conversation
|
AFAIK, libgit2 does not have support for LFS, so that makes me reluctant to add LFS support right now. If we do want to support LFS, it could be tested using the VM infrastructure, see e.g. |
|
I think libgit2 does support custom filter hooks, although it would likely need to shell out to If y'all are open to adding LFS in, I'd be willing to adding integration tests in with this PR as a POC. |
|
@chadac We could also just set |
|
@bouk It should be possible setting this as well. I used the more specific in case there were side effects y'all were avoiding. Can run a test to confirm. |
|
This used to work if you have latest master Notwithstanding, |
|
Closing, since this has been completed in #10153 |
Motivation
Add a flag
-c remote.origin.lfsurl=<actualUrl>togit.ccto support LFS calls end-to-end, unblocking issues wherefetchGitfails on Git repositories using LFS.Context
Resolves: #4623
Currently
fetchGitis incapable of callinggit-lfs. Fortunately, it almost works perfectly asgitproperly hands off necessary calls to a locally installedgit-lfsexecutable, but there is a minor difference in expectations between what is available in the bare Git repository and whatlfsneeds. The error message from LFS is not very descriptive.In particular, git-lfs attempts to discover the remote URL that it needs for fetching artifact URLs using the
remote.origin.urlGit config option, which is not present in the current bare Git repository.While I think setting the
remote.origin.urlmight have undesirable side-effects, LFS accepts an alternative URL via the LFS-specific configuration optionremote.origin.lfsurl.Since
git.ccuses a barecheckoutwhen pulling from repositories using submodules, Git LFS should work in those cases. It's only for repositories without submodules (i.e. when thearchivecommand is invoked) that this configuration option is necessary. Thus, I added it directly as a configuration option on thearchivecommand rather than updating the repository'sconfigfile.One uncertainty that I have: I'm not exactly sure how easy this will be to test. Git LFS usually operates by making an HTTP request to an asset server and I'm not sure if it's feasible to run a test for LFS without needing a lot of extra infrastructure. It also sounds like such tests may be fundamentally changed with this new
libgitapproach. I can provide a sample repository with LFS files to manually verify this change, but I don't know if there is an easy way to test LFS going forward.Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.shsrc/*/teststests/nixos/*Priorities
Add 👍 to pull requests you find important.