-
Notifications
You must be signed in to change notification settings - Fork 10
Support git-lfs (large file storage) #64
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
Open
cgarling
wants to merge
15
commits into
JuliaVersionControl:master
Choose a base branch
from
cgarling:git-lfs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
317931e
Support git-lfs (large file storage)
cgarling 5bb20c1
Update readme to state git LFS support
cgarling 4d63629
Silence lfs git tests
cgarling b98ca06
Check for CI private key in test
cgarling bf81c75
fix check on CI private key
cgarling d539c21
update env var check
cgarling 8f66ab0
Merge branch 'JuliaVersionControl:master' into git-lfs
cgarling b9196af
Read path from `git_cmd`, not global
cgarling fc31cd4
Try using `windows_verbatim` if git-lfs loaded
cgarling 895f9aa
try removing single quotes from cmd.exec
cgarling f1d3d3a
revert quote filtering scheme
cgarling 1df470c
bump Julia compat to 1.8
cgarling ee765d9
julia compat revision
cgarling 9610718
Add CI job for Windows with Julia = 1.7.3
cgarling b63f460
Merge branch 'master' into git-lfs
cgarling File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,20 @@ end | |
@test isdir("Git.jl") | ||
@test isfile(joinpath("Git.jl", "Project.toml")) | ||
end | ||
|
||
# git-lfs tests | ||
withtempdir() do tmp_dir | ||
rname = "repo-with-large-file-storage" | ||
@test !isdir(rname) | ||
@test !isfile(joinpath(rname, "LargeFile.zip")) | ||
run(`$(git()) clone --quiet https://github.com/Apress/repo-with-large-file-storage`) | ||
run(pipeline(`$(git()) -C $rname lfs install --local`; stdout=devnull)) | ||
run(pipeline(`$(git()) -C $rname lfs pull`; stdout=devnull)) | ||
@test isdir(rname) | ||
@test isfile(joinpath(rname, "LargeFile.zip")) | ||
# Test filesize to make sure we got real file and not small LFS pointer file | ||
@test filesize(joinpath(rname, "LargeFile.zip")) > 10^6 | ||
end | ||
end | ||
|
||
@testset "Safety" begin | ||
|
@@ -76,12 +90,12 @@ end | |
@testset "OpenSSH integration" begin | ||
is_ci = parse(Bool, strip(get(ENV, "CI", "false"))) | ||
is_gha = parse(Bool, strip(get(ENV, "GITHUB_ACTIONS", "false"))) | ||
if is_ci && is_gha | ||
ssh_privkey = get(ENV, "CI_READONLY_DEPLOYKEY_FOR_CI_TESTSUITE_PRIVATEKEY", nothing) | ||
if is_ci && is_gha && !isnothing(ssh_privkey) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is logically the same as b98ca06, not a great surprise this doesn't work either. My suggestion was ssh_privkey = get(ENV, "CI_READONLY_DEPLOYKEY_FOR_CI_TESTSUITE_PRIVATEKEY", "")
if !isempty(ssh_privkey Also, the other checks are useless at this point. |
||
@info "This is GitHub Actions CI, so running the OpenSSH test..." | ||
mktempdir() do sshprivkeydir | ||
privkey_filepath = joinpath(sshprivkeydir, "my_private_key") | ||
open(privkey_filepath, "w") do io | ||
ssh_privkey = ENV["CI_READONLY_DEPLOYKEY_FOR_CI_TESTSUITE_PRIVATEKEY"] | ||
println(io, ssh_privkey) | ||
end # open | ||
# We need to chmod our private key to 600, or SSH will ignore it. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be incorrect? On Windows, this means that
git
will now use the systemENV
, rather than the one set by the JLL, right? So it's missing the relevant JLL paths? Which might also be the reason for the CI failure?I was just implementing my own version of this PR (as I hadn't notice this one 😅), and I ended up parsing
git_cmd.env
to ensure that I push to the correct path always. It's a bit noisy and ugly, but it was looking like this:A simpler approach might be to pull something like
out of the
if
and conditionally only add the OpenSSH paths in theif
? But I wasn't 100% sure that's correct either, so I opted for the more convoluted approach where I know I am only minimally changing thePATH
variable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I pulled
path = split(get(ENV, "PATH", ""), pathsep)
out of a block that only runs if the system is not windows so it would make sense I could have missed something like this. The part that confused me was why it passed on the Windows runs with more recent Julia versions and failed on the Julia 1.6 run.I'll try to give this another try tonight or tomorrow. If you see an easy solution, you're welcome to submit a PR against my branch here if you'd like.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @mortenpi, thanks for the suggestion! I think I have something working based on your solution that I'm about to push to see if it fixes the CI errors, but I'm not sure what your line
is supposed to do and it was causing errors so I removed it. LMK of any other changes you would suggest.
Edit: new commit did not fix CI errors -.-