The aim of this commit is to better represent the reference names
using git-ref-format.
The first places to change were the Branch and Tag types. For Branch,
the previous types were simply wrappers around the names. They stay
this way, using RefString instead. For Tag, the `name` field is
replaced with RefString.
Note: The parsing logic becomes easier here by utilising the
Namespaced and Qualified types.
The consequences of these changes meant that areas that used
BranchName or TagName are changed to use RefString.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Other VCS systems are no longer expected to be supported.
Remove the git hierarchy up to the top-level and remove the vcs
hierarchy.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This pragma gets in the way more than it solves anything.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Improve Component::from_refstring by redefining it as
Component::from_refstr. This allows the use of `RefStr` or `RefString`
instead of just RefString.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
If the `qualified` macro was used, the compiler would complain that it
required an import of `Qualified`.
Fixed by importing Qualified within the unsafe block of the definition
of `qualified`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
- Added Oid into Directory and File.
- Moved file content and directory content out into their own.
- Lazily load directory content on-demand.
- Take advantage of git2::tree to retrieve an entry on-demand.
Also added a new example for browsing.
Signed-off-by: Han Xu <keepsimple@gmail.com>
- Replace the existing Repository::new() with ::open()
- Add Repository::discover() to support searching parent directories.
Signed-off-by: Han Xu <keepsimple@gmail.com>
If a Commit was constructed with trailers, they would not be added to
the buffer for committing.
Fix this by parsing the message by inspecting each line for a
potential trailer, if there is one then store it for later, otherwise
keep it as part of the message. This means that a message stays intact
even if a trailer that is expected to parse did not.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Add git trailers to the data of the Commit.
For convenience, git2 is used to extract the git trailers and they are
then converted to `OwnedTrailer`.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
Multihash was deemed as not needed for compatibility since it is
possible to detect a change from SHA1 to SHA256 based on their encoded
lengths. The YAGNI principle is executed and multihash (and minicbor
while we're here) are removed.
This also had an effect on `Urn` which relied heavily on encoding the
value using multihash. The `urn` and `namespace` modules were removed
from radicle-git-types, since they were likely not going to be used
anyway.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
- Update design doc.
- Refactor History API.
- Use FromRevision and IntoCommit traits.
- Add more test cases.
Signed-off-by: Han Xu <keepsimple@gmail.com>
Prepares git-trailers for publishing to crates.io by adding metadata
to the Cargo.toml.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
OwnedTrailer was lacking a Debug impl and access to its values.
Add a Debug derivation for OwnedTrailer and OwnedToken. Make token and
values public. Add Deref implementation for OwnedToken.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
We add tests for ODB functionality, as well as a new `TreeBuilder`
Struct to make building git trees easier (see below).
The `git2::TreeBuilder` can be a pain to use since it has a lifetime
that is tied to the `git2::Repository`. This was causing issues when
trying to write generators for property tests.
Instead, define a custom TreeBuilder which is a defunctionalised list
operations that represent the `insert` and `remove` methods on
`git2::TreeBuilder`.
The implementation of writing a tree then becomes converting the
custom `TreeBuilder` into a `git2::TreeBuilder`.
Signed-off-by: Jorge Iglesias Garcia <me@jorgeig.com>
- Detect renames in Diff by default.
- Remove Vcs trait.
- Move `history()` to be a regular method of RepositoryRef.
- Update design doc.
Signed-off-by: Han Xu <keepsimple@gmail.com>
- Add a code browsing test
- Update design doc, mainly Code Browsing and Diff.
- Simplify `Directory`.
- Remove `Tree` and `Forest`, and `SystemType`.
- Use `Rev` in `diff()`.
Signed-off-by: Han Xu <keepsimple@gmail.com>
It is necessary to specify the version for `radicle-std-ext` in the
`radicle-git-ext` Cargo.toml to publish it to crates.io.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
link-git is still at an early stage and it's not certain what we will
want to keep out of it, thus publishing it should be avoided.
Remove `link-git` from `radicle-git-ext` for the time being.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Attempting to publish these crates results in errors that the
`description` field is missing and that the path dependencies do not
specify versions.
Add the `description` and `keywords` fields to `git-ref-format-core`,
`git-ref-format-macro` and `git-ref-format`.
Add the versions for the dependent crates.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
The namespace functions can read confusingly:
* `namespaced` - the naming sounds like it is namespacing the input,
when in fact it is ensuring that the input is namespaced.
* `add_namespace` - can be read as adding the namespace to the end of
a ref, when in fact it is placed at the beginning.
Change the naming, respectively, to:
* `to_namespaced` - this uses the conversion naming convention
detailed here[0].
* `with_namespace` - reads as plainly namespacing the ref string.
[0]: https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Add a `qualified!` macro to the set of git-ref-format macros. This
allows the construction of a `refs/<cat>/<name>` reference from a
string literal.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
The idea of an owner came from radicle-link storing the signer in the
storage which was needed for performing signing when writing
particular rad references. The peer_id and personal identity was also
stored within the monorepo config.
Since git-storage is just general reading & writing of references and
objects, these concepts are not necessarily needed at this
level. Remove the owner from Write and remove the config module.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
When an object does not exist the `find_*` functions will return
None. It will be a common case that users of the API will follow the
pattern of `find_blob(store, oid)?.ok_or(Error::NotFound)`.
Add fallible functions corresponding to each `find_` function
returning a `git2::Error` if the object is not found.
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>