-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fix support for getting single files from GitHub (v2) #356
base: v2
Are you sure you want to change the base?
Conversation
e03eae6
to
e7578c2
Compare
e7578c2
to
635e41d
Compare
Rebased branch to include new commits since April 2022 - and the change is still relevant and needed. |
This currently fails for GitHub (and possibly other Git repositories) because there is an assumption in the "client.go" file that the "subDir" segment is always a directory. However, for this URL: https://github.com/owner/repo/subdir/file.txt The "subDir" variable would actually be a file ("subdir/file.txt") and hence the client should use "copyFile" rather than "copyDir" when copying the "subDir" to the final destination. This change fixes that to check whether the "subDir" variable is a file or a directory, and appropriately uses "copyDir" or "copyFile". It also returns the single file in the "GetResult" object, if indeed a single file was requested. Tests attached.
635e41d
to
66abd65
Compare
Rebased this branch off of the |
Any news? Still facing this issue... :/ |
@arikkfir sorry for not being able to get to this sooner. Thank you for the contribution. I've assigned the change to myself for review. |
hello, is there any update to this, thanks |
This currently fails for GitHub (and possibly other Git repositories) because there is an assumption in the
client.go
file that thesubDir
segment is always a directory.However, for the URL "https://github.com/owner/repo/subdir/file.txt[](https://github.com/arikkfir)" the "subDir" variable would actually be a file (
subdir/file.txt
) and hence the client should usecopyFile
rather thancopyDir
when copying thesubDir
to the final destination.This change fixes that to check whether the "subDir" variable is a file or a directory, and appropriately uses
copyDir
orcopyFile
. It also returns the single file in the "GetResult" object, if indeed a single file was requested.Tests attached.
This fixes #98