Commit Graph
202 Commits
Author SHA1 Message Date
Fintan Halpenny 24e27f6e87 commit: use read_header
The `Odb::reader` method states:

    Note that most backends do not support streaming reads because
    they store their objects as compressed/delta’ed blobs. If the
    backend does not support streaming reads, use the read method
    instead.

This can lead to objects not being found when verifying for
commits. Instead use `read_header` to determine the `ObjectType` of
the `Oid`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-04 17:27:47 +01:00
Fintan Halpenny 956bf070d4 trailers: add Token constructor
During the reorganisation of the codebase, the constructors for Token
were removed.

Add back a constructor via the `TryFrom<&'a str>` trait.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-04 11:54:21 +01:00
Fintan Halpenny 15014923c7 publish: git-ref-format-{core, macro}, radicle-git-ext, radicle-surf
In an attempt to publish radicle-surf, it could not compile due to
git-ref-format supposedly missing.

This is an attempt to publish the git-ref-format family and
radicle-git-ext again in order to try publish radicle-surf.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-03 20:45:06 +01:00
Fintan Halpenny c0a1bbe8a7 Merge branch 'improve-line'
* improve-line:
  publish: radicle-git-ext and radicle-surf
  surf: improve Line API

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-05-03 20:07:53 +01:00
Fintan Halpenny 9d44dacdae publish: radicle-git-ext and radicle-surf
Publish new versions:
* radicle-git-ext 0.4.0
* radicle-surf 0.10.0

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-03 20:06:40 +01:00
Fintan Halpenny 1ca3ed700d surf: improve Line API
Adds several methods to Line:
* as_bytes -- gets the underlying bytes
* from_utf8 -- convert the Line to a String
* from_utf8_lossy -- convert Line to Cow<str>

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-03 16:09:49 +01:00
Fintan Halpenny a8ce42766f meta: update to git2-0.17.0
Updates all crates to the latest git2 version, 0.17.0.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-04-14 17:07:35 +01:00
Fintan Halpenny 6de53f72d4 Merge remote-tracking branch 'origin/workspace-management'
* origin/workspace-management:
  Archive crates
  git-ext: update to version 0.3.0

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-03-28 10:05:04 +01:00
Fintan Halpenny 1668d9fab3 Archive crates
Move git-commit, git-trailers, and link-git to an archived directory
to hide them away -- showing the intent that radicle-git-ext will be
the main crate for git functionality.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-27 11:01:21 +01:00
Fintan Halpenny e81ea9b558 git-ext: update to version 0.3.0
Update radicle-git-ext to version 0.3.0 for publishing to crates.io.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-27 11:01:21 +01:00
Fintan Halpenny 165f25f03d Merge remote-tracking branch 'origin/verify-commit-data'
* origin/verify-commit-data:
  git-ext: check commit's metadata fields
  meta: update to tempfile 3.4

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-03-09 17:45:15 +00:00
Fintan Halpenny 5c1ae05420 git-ext: check commit's metadata fields
The `Oid`s passed into `Commit::new` for parents and tree are never
verified to be commits or a tree, respectively.

Upon `write` of the commit, read the object using the ODB to determine
its type. If its the incorrect object then function fails without
writing to the ODB.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-09 12:50:39 +00:00
Fintan Halpenny a0eae0e8eb meta: update to tempfile 3.4
A vulnerability in a transitive dependency, remove_dir_all, used by
tempfile was found[0].

Update tempfile to 3.4, which does not depend on remove_dir_all.

[0]: https://rustsec.org/advisories/RUSTSEC-2023-0018

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-03-09 12:38:38 +00:00
Fintan Halpenny a887e542f6 Merge remote-tracking branch 'origin/merge-git-ref-format'
* origin/merge-git-ref-format:
  move git-ref-format to under radicle-git-ext

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-03-01 17:35:29 +00:00
Han Xu 59515f68e8 move git-ref-format to under radicle-git-ext
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-21 20:19:30 -08:00
Fintan Halpenny f06bc38c26 Merge remote-tracking branch 'origin/mergers'
* origin/mergers:
  radicle-git-ext: merge in git-commit

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-21 10:08:06 +00:00
Han Xu c844605121 radicle-git-ext: merge in git-commit
Removed `mod references` and its uses in `radicle-macros` and
`radicle-git-types` crates.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-19 18:43:55 -08:00
Fintan Halpenny a3a63e4d45 Merge remote-tracking branch 'origin/git2-trailers'
* origin/git2-trailers:
  git-commit: remove dependency on git-trailers

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-16 17:05:49 +00:00
Fintan Halpenny ab05b63614 git-commit: remove dependency on git-trailers
The git-trailers crate depends on parsing logic using nom. This is a
heavy dependency for something that can be done using git2.

Remove the dependency of git-trailers in git-commit and localise the
trailer types -- using git2 to parse the trailers out of the git
commit message.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-02-14 15:34:32 +00:00
Fintan Halpenny 2456fcdb04 Merge remote-tracking branch 'origin/newlines'
* origin/newlines:
  git-commit: remove useless check when converting trailers to string.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-10 13:26:29 +00:00
Fintan Halpenny 4457f12428 Merge remote-tracking branch 'origin/update-doc'
* origin/update-doc:
  update docs and add test for commit signature

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-09 09:48:52 +00:00
Fintan Halpenny 18c4f53421 Merge remote-tracking branch 'origin/radicle-git-ext-bump-version'
* origin/radicle-git-ext-bump-version:
  bump up version for radicle-git-ext

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-08 16:27:57 +00:00
Fintan Halpenny e0358441b9 Merge remote-tracking branch 'origin/git-ref-format-bump-version'
* origin/git-ref-format-bump-version:
  git-ref-format: bump up version and add CHANGELOG.md

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-08 16:26:33 +00:00
Fintan Halpenny f40d5fba06 Merge remote-tracking branch 'origin/changelog'
* origin/changelog:
  add CHANGELOG.md

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-08 16:20:14 +00:00
Fintan Halpenny 5fdccdc8f0 Merge remote-tracking branch 'origin/diff-eof'
* origin/diff-eof:
  radicle-surf: Update disabled eof tests to use new methods
  radicle-surf: fix EofNewLine

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-08 16:19:34 +00:00
xphoniex bf31d6f636 radicle-surf: Update disabled eof tests to use new methods
Signed-off-by: xphoniex <xphoniex@users.noreply.github.com>
2023-02-08 15:10:10 +00:00
Han Xu 7f80ab117d git-commit: remove useless check when converting trailers to string.
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-08 00:26:46 -08:00
Han Xu ac9cfc1cc6 git-ref-format: bump up version and add CHANGELOG.md
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-07 04:11:16 -08:00
Han Xu 0f985a8bf6 bump up version for radicle-git-ext
Also added CHANGELOG.md file.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-07 02:38:05 -08:00
Han Xu 5e7c924fba update docs and add test for commit signature
use crates.io for radicle-std-ext

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-07 01:39:24 -08:00
Han Xu ec3374c3c9 add CHANGELOG.md
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-06 21:20:04 -08:00
Han Xu 99732c4fef radicle-surf: fix EofNewLine
- added `NoneMissing` case.
- moved `EofNewLine` into `DiffContent::Plain`.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-06 20:24:00 -08:00
Fintan Halpenny aa6459c883 Merge remote-tracking branch 'origin/finto/blob-improvements'
* origin/finto/blob-improvements:
  surf: improvements to Blob

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-03 09:59:07 +00:00
Fintan Halpenny 787818b194 Merge remote-tracking branch 'origin/diff-file'
* origin/diff-file:
  add diff_file method for Repository.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-03 09:58:40 +00:00
Han Xu 109ca497d4 surf: improvements to Blob
Improve on the previous iteration of `Blob`.

`BlobVec` is simply a `Vec<u8>` underneath, so it is technically not
needed and can be replaced by using `Vec<u8>` directly.

Notice that BlobRef can implement AsRef and Deref for `[u8]`. This
leads to being able to use `T: AsRef<[u8]>` for `Blob` methods and the
`Serialize` implementation.

Apply these two facts and remove any of the remaining code that is no
longer needed.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-01 10:21:47 +00:00
Fintan Halpenny e7766d65d8 Merge remote-tracking branch 'han/rm-blob-content'
* han/rm-blob-content:
  change BlobContent to BlobRef that borrows its content from git2::Blob

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-01 10:08:35 +00:00
Fintan Halpenny 748096d570 Merge remote-tracking branch 'han/doc-update'
* han/doc-update:
  Update doc comments.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-02-01 09:41:00 +00:00
Han Xu 41a2cf5bdc add diff_file method for Repository.
Also refactored `FileDiff` type.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-31 09:10:21 -08:00
Fintan Halpenny ff3c66e114 Merge remote-tracking branch 'han/error-report'
* han/error-report:
  refactoring the error type of this crate.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-30 12:39:46 +00:00
Fintan Halpenny 42302fc5a1 Merge remote-tracking branch 'origin/nix/rust-1.67'
* origin/nix/rust-1.67:
  github: revert toolchain back to stable
  nix: update to rust-1.67

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-30 12:38:03 +00:00
Fintan Halpenny 36fb923bd1 github: revert toolchain back to stable
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-30 11:01:10 +00:00
Fintan Halpenny 7036923712 nix: update to rust-1.67
Rust 1.67 was announced[0].

Update the nix sources to be on par with the latest rustc version.

This required fixes to clippy warnings for using variable
interpolation for format strings.

There was also an advisory error related to libgit2-sys[1], which is
transitively depended on via git2. The fix is included in the 0.16.1
version of git2.

[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html
[1]: https://rustsec.org/advisories/RUSTSEC-2023-0003

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-30 11:00:22 +00:00
Han Xu 995855d9b4 Update doc comments.
This patch focuses on the front page of `cargo doc` output.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-30 02:58:50 -08:00
Han Xu 9f4dce4ffd change BlobContent to BlobRef that borrows its content from git2::Blob
The motivation is to avoid copying the content bytes that could be
potentially quite large.

Also support Blob<BlobRef>::to_owned() just in case.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-29 06:50:11 -08:00
keepsimple1 48022590d0 Merge pull request #104 from keepsimple1/empty-branch-test
radicle-surf: fix history path filter for empty path
2023-01-28 10:20:58 -08:00
Han Xu 755124dab3 fix history path filter for empty path
- add script to update git-platinum
- use Rust 1.66.1 for lint to postpone the move to 1.67.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-24 20:26:58 -08:00
Han Xu 80f8f64e5f refactoring the error type of this crate.
Moved `Error` in `repo.rs` out into a crate level `Error` in `error.rs`.
Repository specific errors are wrapped by the `crate::Error` as well.

Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-24 07:29:55 -08:00
Fintan Halpenny da2b58b867 Merge remote-tracking branch 'han/remove-object'
* han/remove-object:
  move up blob.rs and tree.rs to src/

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-20 08:33:38 +00:00
Han Xu 88e6f0c94c move up blob.rs and tree.rs to src/
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-01-18 09:25:50 -08:00
Fintan Halpenny 640bd9eae5 Merge remote-tracking branch 'han/return-result'
* han/return-result:
  return Result<> instead of Result<Option<>> for find_entry

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-18 08:51:30 +00:00