Git Download Manager

Challanges and Opportunities

{
  "Speaker": "Gaetano Checinski",
  "Company": "LoopPerfect"
  "Role": "Founder & Software Architect"
}

Buckaroo - Decentralized Package Manager

How to Downlaod Commit #deadbeef

from git@github.com:loopperfect/RxTerm.git?

Why not ... ?

git clone $URL && git checkout #deadbeef

Does ... work ?

git clone --depth=1 -n $URL && git fetch #deadbeef

Why doesn't it work?

error: Server does not allow request for unadvertised object #deadbeef

What is an Advertised Object?

  • tips of branches
  • tags

How to discover all Advertised Objects?

git ls-remote --all

Why doesn't it work? - Part II

  • Git needs to compute a diff between the your local commits and the requested commit, but...
  • Git's commits are a singly linked list
  • Every commit only knows it's parent
  • Heads, Tags are references to a commit
  • Which Tag or Head should Git walk to find #deadbeef?

Why doesn't it work? - Part III

git.svg

Git! Just make it work!

[uploadpack]
    allowTipSha1InWant = true
    allowReachableSHA1InWant = true
    allowAnySHA1InWant = true

Most Git Hosts disable this features

Git Shallow + Fetch + Heuristics

  • Use Hints in Manifests and Lockfiles about branches
  • Git clone --depth=1 -n $URL#branchThatLikelyHasDeadBeef
  • git fetch --deepen=$N to get N commits
  • repeat fetch if commit not found. exponentially increase N
  • Inspect Datetime and fetched (SemVer-) Tags to determine if you should give up
  • Repeat process for alternative branches
  • Give up and unshallow Repository by fetching the remaining diffs

How to Copy Commit from (Bare) Repo Cache?

git clone --shared -n path/to/cache.git && git checkout #deadbeef

  • All commits in cache.git available in cloned repos

How to Copy Commit from (Bare) Repo Cache II?

git clone --reference path/to/cache.git git@github.com/owner/repo.git

  • creates a real clone but speeds up download by using the cache.git

Buckaroo - Decentralized Package Manager

https://www.buckaroo.pm