write-yourself-a-git
write-yourself-a-git copied to clipboard
Learn Git by reimplementing it from scratch
I'm new to Python but would love to help out in this project. I spent some time trying to figure out how to run the program as a typical shell...
The current serialization [code](https://github.com/thblt/write-yourself-a-git/blob/75f52c20ad6ed23c37534fe06d2592b42e8408ea/libwyag.py#L398): ``` def kvlm_serialize(kvlm): ... for v in val: ret += k + b' ' + (v.replace(b'\n', b'\n ')) + b'\n' ``` The code replaces every new...
1. No need to use OrderedDict. This is the default dictionary, officially since Python 3.7, practically since Python 3.6. Not using it can simplify this extremely simplified article even more....
Section 7.6.1 rewrites `object_resolve()` to resolve object hashes using regular expressions. However, the new implementation appears to be flawed in a few ways. First, the function cannot properly identify full-length...
In [the section 6.2 in the blog article](https://wyag.thb.lt/#org900f937) it says `[mode] is up to six bytes`, and the code includes [an assertion that checks the length of mode is 5...
Have you thought of using SHA-256 since Git is pretty close to switching to SHA-256 in the near future due to collisions found in the wild?
Add code like this just before `return candidates`: ```python # search for branches and tags (with or without "refs" and "heads" or "tags" prefixes) for path in [f'refs/heads/{name}', f'refs/tags/{name}', f'refs/{name}',...
It's nice how you put your code in a seperate libwyog.py, but consequently, libwyog.py should only "export" (aka define) functions for like init, add, commit, etc and the wyog executable...