Implementing (parts of) git from scratch in Rust

preview_player
Показать описание


Video isn't sponsored (as in, I get no money for making the video), though like last time the above _is_ a referral link so that _if_ you find it useful and end up paying that also helps me — maybe a good use for an employee learning budget!

Various links from the video:

My (well, J's) Discord:

GitHub sponsors:

Missing Semester class on git:

Code at the end:

0:00:00 Introduction
0:02:39 Housekeeping
0:04:36 Questions before we start
0:08:39 Initializing the challenge
0:09:47 git init
0:25:27 git cat-file
0:58:21 Mitigating zipbombs
1:08:37 git hash-object
1:41:50 Organize into modules
1:47:41 git ls-tree
2:24:21 git write-tree
3:41:45 git commit-tree
3:59:06 git commit
4:23:56 Outro

Рекомендации по теме
Комментарии
Автор

Not only the best resource for learning Rust on the internet, also one of the most clear and easy to follow programming tutors on the internet. Thanks for all you do, Jon!

laurenlewis
Автор

Jon's channel is my favorite place on internet and earth thank you Jon please do more of these

yotubecreators
Автор

Thank you for the video.
I am writing in the Rust from last 2 years for commercial company.

It's a coincidence that my name is previewing in your video @01:09 "mohitagnihotri", I have implemented this challenge own self (no external reference) and now comparing my solution with yours.
I learn not only from your way of Rust code implementation but I also take some lessons from your thought process.
Really very beneficial for me.
Thankful to you!!!

MohitAgnihotri
Автор

Hey man, just wanted to say I love your stuff.
This kind of stream actually sold me on streaming CodeCrafters myselft, and on playing with Rust as well.
Keep it up!

DotDager
Автор

The cross-platform gymnastics git has to do is truly spooky.

driedurchin
Автор

This blows me away. I thought there is more "magic" in git. Nice to learn how it works. I'm currently learning rust and had a good time following your explanations. You have a very good style of explaining things!

flwi
Автор

Another neat thing to implement might be an Entity Component System like FLECS / shipyard / etc

jordanyates
Автор

3:19:10 The write-tree ordering was bugging me, so I looked at what git.git does. The ordering of the tree contents is just based on comparing bytes (strcmp), but they are sorting the entire index which has entries like "src/commands-rs" and "src/commands/write_tree-rs" (using dashes instead of dots to avoid becoming links). So the ordering in the tree object includes a phantom "/" at the end of a directory name.

Ignoring the index probably makes the examples easier, but make actually working like git much harder.

Benabik
Автор

**british DJ voice** one of the best one of the best

more of these building complex systems long form videos please bossman

cooldude
Автор

Jon, a walk through the actix framework would be nice for someone like me trying to understand the actor model

kenzo
Автор

Wait, you're one of the missing semester folks? Holy crap you're the goat

clubpenguinfan
Автор

Haven't watched it yet, but as someone still getting acquainted with rust and craving a deeper understanding of gits internals, I look forward to seeing what you've done.

codingcoyote
Автор

I watched all of your videos and they're so well made. Thanks so much for this content. You are amazing!

danygagnon
Автор

This is like crack to me, I can't get enough! Not only do I learn more Rust, I learn more stuff about git! I wish this challenge would continue until a fully featured git clone (😉) would be implemented!

Joqer
Автор

I love to send this kind of material to people.
I'm thinking of doing my own spin on these types of challenges, where we start with a discussion of the problem and datastructure and dataflow design, and then build in a way that is *fast* by the time the tutorial is done. For example in this or the bittornent one, architecting for io_uring and mmap, instead of high overhead POSIX stuff.

microcolonel
Автор

Great episode! Not only did I learn a bit about Rust, but I also learned quite a bit about git! Nice :)

JaLikon
Автор

Nice content! My implementation used a lot of in-memory strings compared to your streaming implementation. This is definitely very educational!

LesleyLai
Автор

Interesting note: not sure about the rest of the plumbing but `git cat-file` itself will ignore the size value and print the entire rest of file. I used the same basic idea you used for your type (i.e. read one byte extra and compare how much was read) and created an object with a mangled size for testing. Tried it on both, mine worked, proper git printed the entire file.

dantenotavailable
Автор

I was inspired by this and did the redis challenge. It was super interesting and I learned a lot. It would be awesome to see Jon have a stab at it the "correct" way. I have a little bit of trouble of finding correct mental model of TCP and how to parse it incrementally without excessive cloning, it's hard to search youtube or google for good information. If you have any recommendations for material I would be interested!

puolisointu
Автор

My brain already hurts after watching just about a third of the video, but it _is_ amazing. Thanks for this!

steffenuhlig