Skip to content

Commit 345b559

Browse files
Challenge 26 - Write Your Own Git (#37)
* 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
1 parent e577efb commit 345b559

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4126
-42
lines changed

.gitignore

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
.idea/
2-
**/node_modules/
3-
**/build/
4-
.vscode/
5-
coverage/
6-
logs/
1+
.idea/**
2+
**/node_modules/**
3+
**/build/**
4+
.vscode/**
5+
coverage/**
6+
logs/**
77
**/*.env

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Checkout my [Notion](https://mohitjain.notion.site/Coding-Challenges-af9b8197a43
4444
23. [Write Your Own Traceroute](src/23/)
4545
24. [Write Your Own Realtime Chat Client and Server - Duplicate of Write Your Own IRC Client](src/16/)
4646
25. [Write Your Own NATS Message Broker](src/25/)
47+
26. [Write Your Own Git](src/26/)
4748

4849
## Installation
4950

0 commit comments

Comments
 (0)