Giter Club home page Giter Club logo

vcs-go's Introduction

vcs-go

Introduction

This is the Go version of Gitlet from this project written in JAVA. I try to follow all the concept in this project and reproduce in Go.

  • store files / metadata in .vgo/ folder

  • commands

    • init
    • add
    • status
    • commit
    • rm
      • unstage the file
    • log
      • show the history of current node
    • checkout
      • file: take out the file from the HEAD commit to the working directory
      • commit_id file: take out the file from the specific commit to the working directory
      • (advanced) branch_name: switch to the branch
    • (advanced) other commands for branch -> refer to external link for detail

file structure

  • File structure for the project is as follows:
.
├── cmd
│   └── cli
│       ├── commands
│       │   ├── init.go
│       │   └── root.go
│       ├── main.go
│       └── utils
│           ├── file.go
│           └── serialize.go
├── go.mod
├── go.sum
├── README.md
└── testfolder

Test for each file are included in the same folder as the file itself.

  • utils: tool functions

  • commands: each commands shown in Introduction has its own folder

  • The committed files are stored in .vgo/objects folder. The file structure is as follows:

/my_project
    .vgo
        /objects
            6a/
                7f3  # Serialized content of a blob with hash starting with 6a7f3...
            2f/
                4f2  # Serialized content of a tree with hash starting with 2f4f2...
            d1/
                2f5  # Serialized content of a commit with hash starting with d12f5...
        /refs
            /heads
                main  # Pointer to the latest commit on the main branch
        HEAD  # Pointer to the current commit checked out

Usage

Test

  • Go to the folder of the file you want to test, run following:
go test

To see more details of the test, run:

go test -v

TODO

  • init
    • create .vcsgo folder with empty structures inside
    • Detect if .vcsgo folder already exists
  • Serialization
    • files into blob
    • Serialize the file blob and deserialize
    • Hash the file blob
    • file tree into blob
      • Get file with directory structure
      • hashmap for file dir structure to SHA-1 hash of the file
    • commit into blob
  • SHA-1 hashing function
    • Hash from serialized objects -> get hash string
    • Store hash string in .vcsgo/objects
  • add
  • commit
  • log
  • checkout
  • rm
  • branch operation...

Work Log

27/07/2024

  • Finish Serialization function for the file contents
  • Get the files with their directory structure

vcs-go's People

Contributors

machichima avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.