Skip to content

Commit

Permalink
Challenge 26 - Write Your Own Git (#37)
Browse files Browse the repository at this point in the history
* Completed git init command with tests

* Added objects/info and objects/pack dir in init command

* added copy files for challenge-26 command while building. Started hash-object function and added tests

* Added write option support in hashObject function. Updated tests for hashObject functionality

* Added catFile command support and tests. Refactored code. Added jestHelpers

* Refactored args for each command to improve TDD

* refactored all the commands to simply return a string output or raise error. Added updateIndex command

* refactored constants, added index file parser, added update-index command tests

* renamed index.ts to git.ts

* added 'add' command

* Added status command, updated tsconfig to support glob package

* added extension parsing, create Index class, refactored code

* added write tree functionality. Added mode field to IndexEntry. Added Tree object.

* removed console.log statement from status.ts

* Refactored types.ts

* refactored fileModeString and fileType function

* added functionality to run commands from inside the git repo

* Added more tests for updateIndex command

* Added comments and TODOs. Updated init.test.ts

* Added tests for indexParser

* removed add argument from updateIndex. Completed write-tree command. Created tree for filesystem

* Completed write-tree command with dir and subdir entries. Fixed typo in writing cachedtree to index. Moved functions to utils. refactored code.

* Added commit-tree command. Added utils to read user info from .gitconfig

* added tests for utils.ts

* Updated timezoneoffset calculation. handled deleted files in update-index command

* refactored catfile.ts, added util function to parse gitObject

* Added decode Tree function

* Added Signature class, refactored code. Added function to retireve commit tree hash value from .git/refs/heads. Added decode commit functionality

* Fixed decoding a tree. Fixed tree insert function. Completed status command.

* Added tests for writeTree. Fixed insert function of Tree. Fixed decodeTree function

* added tests for commitTree command. Added tests for Signature class. Fixed decodeCommit function and decodeSignature function

* completed commit command. Added more info about commit in status output

* Added JSDOC about packfile while using parseObject function

* Completed git diff. Refactored code to retreive file statuses

* Added README. Added docs folder for commad description. Completed doc for init command

* Added docs for hash-object and cat-file command. Update doc for init. Update README and added links to new command docs

* Added docs for update-index/add and status command.

* added docs for write-tree, commit-tree, commit and diff command. Updated links in README as well.

* Added JSDOC. Added more comments. Refactored interfaces

* mocking getSignature function in tests. Fixed getTimeAndTimeZone function

* Added link to challenge 26 in global README
  • Loading branch information
jainmohit2001 authored Oct 4, 2023
1 parent e577efb commit 345b559
Show file tree
Hide file tree
Showing 54 changed files with 4,126 additions and 42 deletions.
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.idea/
**/node_modules/
**/build/
.vscode/
coverage/
logs/
.idea/**
**/node_modules/**
**/build/**
.vscode/**
coverage/**
logs/**
**/*.env
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Checkout my [Notion](https://mohitjain.notion.site/Coding-Challenges-af9b8197a43
23. [Write Your Own Traceroute](src/23/)
24. [Write Your Own Realtime Chat Client and Server - Duplicate of Write Your Own IRC Client](src/16/)
25. [Write Your Own NATS Message Broker](src/25/)
26. [Write Your Own Git](src/26/)

## Installation

Expand Down
Loading

0 comments on commit 345b559

Please sign in to comment.