Skip to content

A pure Scala implementation of the Git version control written from scratch.

License

Notifications You must be signed in to change notification settings

kaisellgren/ScalaGit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

   ,-,--.    _,.----.    ,---.                  ,---.                 _,---.   .=-.-.,--.--------.
 ,-.'-  _\ .' .' -   \ .--.'  \       _.-.    .--.'  \            _.='.'-,  \ /==/_ /==/,  -   , -\
/==/_ ,_.'/==/  ,  ,-' \==\-/\ \    .-,.'|    \==\-/\ \          /==.'-     /|==|, |\==\.-.  - ,-./
\==\  \   |==|-   |  . /==/-|_\ |  |==|, |    /==/-|_\ |        /==/ -   .-' |==|  | `--`\==\- \
 \==\ -\  |==|_   `-' \\==\,   - \ |==|- |    \==\,   - \       |==|_   /_,-.|==|- |      \==\_ \
 _\==\ ,\ |==|   _  , |/==/ -   ,| |==|, |    /==/ -   ,|       |==|  , \_.' )==| ,|      |==|- |
/==/\/ _ |\==\.       /==/-  /\ - \|==|- `-._/==/-  /\ - \      \==\-  ,    (|==|- |      |==|, |
\==\ - , / `-.`.___.-'\==\ _.\=\.-'/==/ - , ,|==\ _.\=\.-'       /==/ _  ,  //==/. /      /==/ -/
 `--`---'              `--`        `--`-----' `--`               `--`------' `--`-`       `--`--`

Scala Git

A pure Scala implementation of the Git version control.

Note: this project is still a work-in-progress.

Build Status

Examples

// Open a repository.
val repo = Repository.open("path/to/repo")

// Print all tags.
Tag.find(repo).foreach(println)

// Print author names of every commit.
Commit.find(repo).foreach((c: Commit) => println(c.authorName))

// Print last 10 commits.
Commit.find(CommitFilter(limit = 10))(repo).foreach(println)

// Print branch tip ids.
Branch.find(repo).foreach((branch: Branch) => {
  val tip = Branch.tip(branch)(repo)
  println(tip.id)
})

// Print repository head.
Repository.head(repo) match {
  case None => println("no HEAD on this repo")
  case Some(b) => println(b.tipId)
}

// Create a new tag.
val tag = Tag.create("something")

// What commit does the tag point to?
val commit = Tag.commit(tag)

// Delete the tag we just created.
Tag.delete(tag) // or just Tag.delete("something")

// Adds the given entity to the index.
Index.add("path/to/file")(repo)

Contributing

  • Fork and clone the repository.
  • Run sbt update. If you use IntelliJ, you may run sbt gen-idea as well.
  • Sources at src/main/scala/ and tests at src/test/scala/.

License

This library is licensed under MIT.

About

A pure Scala implementation of the Git version control written from scratch.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages