Fenrir.Git
1.0.0
dotnet add package Fenrir.Git --version 1.0.0
NuGet\Install-Package Fenrir.Git -Version 1.0.0
<PackageReference Include="Fenrir.Git" Version="1.0.0" />
<PackageVersion Include="Fenrir.Git" Version="1.0.0" />
<PackageReference Include="Fenrir.Git" />
paket add Fenrir.Git --version 1.0.0
#r "nuget: Fenrir.Git, 1.0.0"
#addin nuget:?package=Fenrir.Git&version=1.0.0
#tool nuget:?package=Fenrir.Git&version=1.0.0
Fenrir 
Fenrir is a .NET library to work with Git repositories. It provides functions to read Git objects, traverse the commit graph, extract trees and files from any commit, etc. Essentially, it provides tools to create your own Git client or transform a repository in any way.
[!CAUTION] Some of Fenrir's functions perform inline modifications of Git repositories and may destroy information and even commit history!
Always make sure to take a backup before using Fenrir on important data!
Usage
Fenrir is a .NET library, and thus you can install it into your program via NuGet. Visit the package's page on nuget.org, or install the Fenrir.Git library using your preferred .NET package management tool.
Read the API reference to know more of the usage patterns. While Fenrir is written in F#, it provides an API friendly to other .NET languages.
Fenrir also provides a terminal tool, Fenrir.Application, as a showcase of what is possible to do using the library. Download the application from the releases section, and see the separate documentation file on the application.
If you are looking for some usage examples, check the GitRepositoryModel.fs
file, or see the API documentation.
Versioning Policy
This project's versioning follows the Semantic Versioning 2.0.0 specification. Only changes in the NuGet package are considered. The example application can change at any time.
Documentation
License
The project is distributed under the terms of the MIT license.
The license indication in the project's sources is compliant with the REUSE specification v3.3.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- ChangelogAutomation.MSBuild (>= 2.0.0)
- FSharp.Control.AsyncSeq (>= 3.2.1)
- FSharp.Core (>= 9.0.201)
- JetBrains.Lifetimes (>= 2025.1.1)
- SharpZipLib (>= 1.4.2)
- TruePath (>= 1.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
[Changed]
- Breaking change summary:
- most of the APIs that accept any file system paths now require them wrapped in TruePath.LocalPath,
- the newly introduced type Fenrir.Git.Sha1Hash is now thoroughly used in the public API,
- a lot of synchronous functions performing blocking I/O have been converted to asynchronous,
- a lot of APIs have been removed from the public surface.
- Breaking changes:
- Commands.SHA1 returns a Sha1Hash now;
- Commands.TreeStreams.Hashes is now an array of Sha1Hash objects;
- Commands.commitBodyToStream has been moved to Commits.WriteCommitBody, and now now requires non-curried arguments;
- Commands.createEmptyRepo has been renamed to InitializeRepository, and now requires a LocalPath as an argument;
- Commands.getRawObjectPath has been renamed to Objects.GetRawObjectPath, now requires LocalPath and Sha1Hash as arguments;
- Commands.guillotineObject has been moved to Objects.Guillotine, and now requires non-curried arguments;
- Commands.headifyStream has been moved to Objects.WriteObject, and now requires non-curries arguments and returns a Sha1Hash;
- Commands.parseCommitBody has been moved to Commits.ReadCommit, now requires PackIndex, LocalPath and Sha1Hash as arguments (non-curried anymore), and returns a Task (i.e., made asynchronous);
- Commands.parseTreeBody has been moved to Trees.ParseTreeBody, now requires PackIndex, LocalPath and Sha1Hash as arguments, and returns a Task;
- Commands.readHeader has been renamed to Objects.ReadHeaderFromStream;
- Commands.readObjectHeader has been moved to Objects.ReadHeader, now requires PackIndex (see below), LocalPath and Sha1Hash as arguments, returns a Task;
- Commands.streamToCommitBody has been moved to Commits.ReadCommitBody;
- Commands.treeBodyToStream has been moved to Trees.WriteTreeBody, and now requires non-curried arguments;
- Commands.updateObjectInTree now requires a PackIndex, Sha1Hashes and LocalPath as arguments (non-curried), and returns a Task;
- Commands.verifyPack has been renamed to VerifyPackFile, now requires a LocalPath as an argument, and requires the arguments in non-curried form;
- Commands.writeObjectHeader has been moved to Objects.WriteHeader, and now requires non-curried arguments;
- Commands.writeStreamToFile has been moved to Objects.WriteToFile, and now requires LocalPath and Sha1Hash as arguments (non-curried);
- Commands.writeTreeObjects has been renamed to WriteTreeObjects, now requires LocalPath as an argument, and requires non-curried arguments;
- Metadata.CommitBody.Parents is now an array of Sha1Hashes;
- Metadata.CommitBody.Tree is now a Sha1Hash;
- Metadata.TreeAtom.Hash is now a Sha1Hash;
- Metadata is no longer a module but now a namespace, meaning all the nested types are now top-level types in the namespace;
- Ref.CommitObjectId is now a Sha1Hash;
- Refs.ReadHeadRef has been renamed to ReadHead;
- Refs.isHeadDetached has been renamed to IsHeadDetached, and now requires a LocalPath as an argument;
- Refs.readRefs has been renamed to ReadRefs, and now requires a LocalPath as an argument;
- Refs.updateAllRefs has been renamed to UpdateAllRefs, now requires LocalPath and Sha1Hashes as arguments;
- Refs.updateHead has been renamed to UpdateHead, now requires Sha1Hash and LocalPath as arguments (non-curried form);
- Sha1.calcSHA1Hash has been renamed to CalculateHardened, and now returns a Sha1Hash;
- Zlib.packObject has been renamed to PackObject, and now requires the arguments in the non-curried form;
- Zlib.unpackObjectAndReturnPackedLength has been renamed to UnpackObjectAndReturnPackedLength, and now requires the arguments in the non-curried form;
- Zlib.unpackObject has been renamed to UnpackObject, and now requires the arguments in the non-curried form.
- Other changes:
- #111 (https://github.com/ForNeVeR/Fenrir/issues/111): added an API and implementation for faster commit enumeration.
- Packing.PackedObject.Stream is now a general Stream instead of a MemoryStream.
[Removed]
- Breaking:
- Commands functions have been removed from the public API:
- SHA1,
- changeHashInCommit,
- changeHashInTree,
- doAndRewind,
- getHeadlessCommitBody,
- getHeadlessTreeBody,
- hashOfObjectInTree,
- refsCommand,
- streamToTreeBody;
- DeltaCommands module has been removed from the public API;
- PackVeritication module has been removed from the public API;
- Refs functions have been removed from the public API:
- identifyRefs,
- updateRef;
- everything from Sha1 module except for the CalculateHardened function (see above) has been removed from the public API;
- Tools module has been removed from the public API
- (this includes all the extension methods for BinaryReader provided by the package);
- UbcCheck module has been removed from the public API;
- Zlib.getDecodedStream has been removed from the public API.
[Added]
- The whole public API has been covered by documentation.
- A new Commits module, with several functions moved from the Commands module (see above).
- Commits.TraverseCommits for listing all the parent commits of a certain commit.
- A new Objects module, with several functions moved from the Commands module (see above).
- A new Trees module, with several functions moved from the Commands module (see above).
- A new type, Metadata.Commit — for keeping a CommitBody together with its Hash.
- A new type, PackIndex — to preserve and efficiently use the pack index data between different commands — for example, for faster commit traversal (#111 (https://github.com/ForNeVeR/Fenrir/issues/111)).
- A new type, Sha1Hash, as a quick wrapper over an SHA-1 hash value (represented as raw bytes).