Feedback request on my first project (git clone implementation)

Hi all, I've recently re-implemented a small subset of git for learning purposes.

This was my first project in Rust, that is, beyond small exercises and closer to the real world. Even though this is a toy project, I tried coding it cleanly, using the right tools and paying attention to memory management (specifically, processing files in a streaming fashion as opposed to holding a full copy in memory at once).

If anyone with more Rust experience can look at it, I'd greatly appreciate any feedback. In particular, if some of the code is not idiomatic, or things could be done in simpler or more robust way.

Here's a link to the repo on github: GitHub - mpg/codecrafters-git-rust: My work on codecrafter's git challenge, in Rust - the whole thing is about 1100 lines of code, and of course even a partial review would already be very helpful.

Thanks in advance!

1 Like

Did you watch Jon Gjengset's video on this topic? https://www.youtube.com/watch?v=u0VotuGzD_w

Regarding your code, I currently do not have time for a full review, but your Mode::to_str() method seems ill designed. It returns the file modes as strings whereas you should™ handle them as an unsigned integers, e.g. a u16. I.e. 0o100644 instead of "100644".

1 Like

Thanks for taking a look! Yes, I've watched Jon Gjengset's video, and found it really informative - not just the final solution, but a view into the thought process behind it, great resource!

Hello, there! I am not an advanced rust programmer :sweat_smile: but I am learning it too! It is a little bit hard to find some mentorship. I will take a look at your git project after I finish mine, because I am also using the code crafters platform and I plan to do the git project in the future.
But anyways, good learning for you! If you want to share any cool project or opportunity for learning, feel free to contact me.