Another git repository downloader

Started by SquidDev, May 18, 2019, 08:14 PM

Previous topic - Next topic

SquidDev

OK, so this is a silly little project I mostly knocked together a couple of years ago (June 2017) and then finished off this morning. I'm not going to pretend it's polished or well written, but it works!



No, I know what you're thinking, "Oh great, it's another git-get clone". But oh no, it's a git clone clone1. This should work with any Git repository2 (as long as it supports https), not just GitHub's!

If you fancy a play, you can download it: wget https://gist.githubusercontent.com/SquidDev/e0f82765bfdefd48b0b15a5c06c0603b/raw/clone.min.lua

I can't imagine this is really useful truth be told, but it's a nice POC. It may be a little slower than git-get. While the downloading is very fast, we then have to decompress the downloaded files, which isn't especially fast on ComputerCraft. On the bright side, it's not held to the same rate limits as GH's own API, so might be useful for servers or something.

1: Sadly you can't clone git-get, as it's not on git. Ironic really.
2: OK, so I haven't added timeout protection everywhere, so it will fail if downloading massive files. Like I said, it's not polished.
GitHub | CC:Tweaked: A ComputerCraft fork | Plethora: A peripheral mod

EveryOS

Now we just need a way to push to git!
Quick question, does this generate the .git/ folder?
~Google

SquidDev

Quote from: EveryOS on May 22, 2019, 01:07 PMNow we just need a way to push to git!
Quick question, does this generate the .git/ folder?
Pushing is a little bit harder, as you need to compress the files, and I'm not aware of a pre-existing pure Lua DEFLATE compressor (there's plenty of decompressors out there).

No, it doesn't generate the .git folder, though I suspect it wouldn't be too hard to add - we're downloading all the required information, just not bothering to keep it around afterwards.
GitHub | CC:Tweaked: A ComputerCraft fork | Plethora: A peripheral mod

EveryOS

Ok. Also, I think the original git-get does not work anymore (I think API v2 is down), so this definitely would be useful.
~Google

pjals

hi i am T79, bye

SquidDev

Quote from: pjals on Mar 16, 2020, 05:47 PMcreate a api for this, please
The source is available on my GitHub, so it should be pretty easy to yoink those and copy them into your own project along with the license. I've not got any plans right now to develop this further, frankly all I really wanted was a "look, it's possible to do this", and maybe encourage someone to build a little further using it.
GitHub | CC:Tweaked: A ComputerCraft fork | Plethora: A peripheral mod

QuickMuffin8782

#6
Hmm... I am using CC on a emulator (don't have java), but I can translate this for CCWindows, the operating system source I downloaded. I will give credit to you SquidDev! (Oh boy, don't know what I am doing here)
"The Blue Blur" - Working on Net Star OS, a new frontier for Red Star OS 3.0
linktr.ee/quickmuffin8782