Commit Graph
100 Commits
Author SHA1 Message Date
Fintan Halpenny 2391c25e95 surf: add submodule support
Git [submodules] are encoded as commits when walking a Git tree. To
allow the support of them in `radicle-surf`, the tree entry is checked
for this case. The entry will be treated such that it is has a name,
prefix, Oid, and the submodule's URL.

It's important to note that the Oid is not usable within the context
of the repository that is being browsed, since they are entirely
separate.

Instead, the URL should be used in conjunction with the Oid for
browsing purposes outside of `radicle-surf`. However, in a future
iteration it may be considered to be able to browse the local contents
of the submodule, if possible.

N.b. getting the submodule and its URL is not supported for a bare
repository, since it will complain about not having a working tree.

[submodules]: https://git-scm.com/book/en/v2/Git-Tools-Submodules

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-06 15:59:57 +00:00
Fintan Halpenny d5bf8e7f68 nix: update to rust-1.76
Run `niv update` to get the latest Rust toolchain.

This required applying some clippy improvements:

- Removing unnecessary re-export of Oid in `stats` module.
- Replace `get(0)` with `first`

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2024-03-05 09:59:12 +00:00
Fintan Halpenny e0b8789b47 git-ext, surf: update git2-0.18.1
Update git2 version to 0.18.1 and provide an updated release version
of radicle-git-ext 0.7.0 and radicle-surf 0.18.0.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-12-04 10:57:39 +00:00
Fintan Halpenny da05e409da surf: release 0.17.1
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-23 09:17:12 +00:00
Fintan Halpenny 71392e70a9 Merge remote-tracking branch 'origin/blob_ref'
* origin/blob_ref:
  surf: expose BlobRef

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-11-23 09:13:36 +00:00
Fintan Halpenny d3dd777d95 surf: expose BlobRef
The current `blob` function is limited to always associating a Blob
with a Commit.

Expose `BlobRef` through a `blob_ref` method, and add useful methods
and serialization to it.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-22 14:53:09 +00:00
Fintan Halpenny ab791d5f2c nix: update rust-1.74.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-11-22 14:11:52 +00:00
Fintan Halpenny f83c6d6856 surf: release v0.17.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-10-02 10:38:58 +01:00
Fintan Halpenny e7e059e233 Merge remote-tracking branch 'sebastinez/add-line-stats-per-file'
* sebastinez/add-line-stats-per-file:
  surf: Add `stats` property to each `DiffContent::Plain`

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-10-02 10:35:01 +01:00
Fintan Halpenny 3c8e3cd9d8 Merge remote-tracking branch 'sebastinez/add-small-disclaimer-on-diff-commits-fn'
* sebastinez/add-small-disclaimer-on-diff-commits-fn:
  surf: Add a small explainer on binary detection in diffs

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-10-02 10:19:16 +01:00
Fintan Halpenny 25b6fcea2f surf: release v0.16.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-09-25 09:57:00 +01:00
Fintan Halpenny 80ac22a7e2 Merge remote-tracking branch 'sebastinez/add-current-oid-to-filediff'
* sebastinez/add-current-oid-to-filediff:
  surf: Add `DiffFile`s to `FileDiff` variants without a diff

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-09-21 15:07:56 +01:00
Fintan Halpenny 1872717660 surf: publish v0.15.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-09-01 08:57:06 +01:00
Fintan Halpenny 31c6d7c28f Merge remote-tracking branch 'origin/surf/improve-moved-diff'
* origin/surf/improve-moved-diff:
  surf: improve Moved type for Diff's

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-09-01 08:53:25 +01:00
Fintan Halpenny 6ee2815cbf surf: improve Moved type for Diff's
In some cases a moved file can also be modified and in these cases
there will be a diff as well as new Oid's for the two sides of the
diff.

Add DiffFile to the Moved type, changing the insert_moved method to
accept the DiffFile's and the DiffContent.

When serializing a Moved, if the old and the new are the same then the
serialization of the diff files and content are skipped -- same as the
old behaviour. Otherwise, the two sides are serialized along with the
content.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-08-30 17:10:25 +01:00
Fintan Halpenny bc06ee0773 nix: update to rust-1.72.0
Update the toolchain to rust-1.72.0. This brought with it a new clippy
check for needless '#'s for string literals. However, this is a false
positive and is being tracked here[[0]].

[0]: https://github.com/rust-lang/rust-clippy/issues/11402

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-08-30 16:16:29 +01:00
Fintan Halpenny 60e919a2bf Merge remote-tracking branch 'diff-pub'
* diff-pub:
  surf: Open Diff to custom construction

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-08-25 08:40:20 +01:00
Fintan Halpenny 982f71638b surf: release v0.14.1
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-08-16 10:09:39 +01:00
Fintan Halpenny a3d2cc80e0 nix: update toolchain to rust-1.71.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-08-10 09:53:02 +01:00
Fintan Halpenny 3ad3a85b63 Merge remote-tracking branch 'slack-coder/typo'
* slack-coder/typo:
  Fix Modification doc typo

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-08-01 16:00:28 +01:00
Fintan Halpenny faec1844b5 surf: update Cargo metadata
The homepage and repository fields were out of date. Update them to
the new radicle-git link.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-07-27 16:44:15 +01:00
Fintan Halpenny b1984bd3f8 Merge remote-tracking branch 'seb/sebastinez/fileDiff-path'
* seb/sebastinez/fileDiff-path:
  surf: Add `FileDiff::path` method

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-07-24 18:16:09 +01:00
Fintan Halpenny e6a20735c6 surf: release v0.14.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-06-22 12:49:54 +01:00
Fintan Halpenny 2a555e726a Merge remote-tracking branch 'origin/cloudhead/hunk-ranges'
* origin/cloudhead/hunk-ranges:
  surf: Add hunk lines ranges

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-06-22 12:46:06 +01:00
Fintan Halpenny 045a2d6534 publish: radicle-git-ext, git-ref-format-*, radicle-surf
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-06-02 13:40:33 +01:00
Fintan Halpenny 9bc0d118a0 publish: radicle-git-ext-0.5.1, radicle-surf-0.12.1
Add features to radicle-git-ext to access the bstr and
percent-encoding features of git-ref-format.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-31 13:57:36 +01:00
Fintan Halpenny 2545a01fec surf: release v0.12.0
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-26 20:45:51 +01:00
Fintan Halpenny 6348e48e1f Merge remote-tracking branch 'origin/cloudhead/add-file-info-to-diff'
* origin/cloudhead/add-file-info-to-diff:
  Add file information to diff

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-05-26 08:58:45 +01:00
Fintan Halpenny 5513ba4f41 publish: radicle-surf 0.11.0
Publish radicle-surf, updating radicle-git-ext and allowing a minicbor
feature flag.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-10 10:37:13 +01:00
Fintan Halpenny 6309dea70d publish: radicle-git-ext 0.5.0
Publish radicle-git-ext to include the following changes:
* Hiding minicbor behind a feature flag
* Fix to commit author's time display/parse

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-10 08:59:30 +01:00
Fintan Halpenny 8d4d3faeeb Merge remote-tracking branch 'origin/dave/fix-author-timestamp'
* origin/dave/fix-author-timestamp:
  git-ext: Display/parse timezone offset in the format git2 expects.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-05-10 08:57:41 +01:00
Fintan Halpenny 0897f918e6 radicle-git-ext: feature flag minicbor
Hide the minicbor feature of git-ref-format behind a minicbor feature
flag in radicle-git-ext.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-08 12:47:51 +01:00
Fintan Halpenny 4c9e958dd7 publish: radicle-git-ext, git-ref-format, radicle-surf
git-ref-format-core included the required changes and was missed via
the last publish. Publish the set of crates bumped up to a new semver.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-05 10:37:50 +01:00
Fintan Halpenny 30693264da Merge
* radicle-git improvements:
  publish: git-ref-format, radicle-git-ext, radicle-surf
  git-ref-format: add Refspec type
  commit: use read_header
  trailers: add Token constructor

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-05-05 10:12:19 +01:00
Fintan Halpenny fc6a4fcac5 publish: git-ref-format, radicle-git-ext, radicle-surf
Publish git-ref-format, radicle-git-ext, and radicle-surf with several
additions and bug fixes.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-05 10:11:13 +01:00
Fintan Halpenny 64fef2f0ad git-ref-format: add Refspec type
Add a Refspec type that represents a `[+]<src>:<dst>` refspec[[0]].

[0]: https://git-scm.com/book/en/v2/Git-Internals-The-Refspec

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-05-05 09:50:53 +01:00
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
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
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
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
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
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
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
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
Fintan Halpenny 016ece6647 Merge remote-tracking branch 'han/fix-commit'
* han/fix-commit:
  consolidate object::commit.rs with commit.rs

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-12 17:43:22 +00:00
Fintan Halpenny 30e02b756f Merge remote-tracking branch 'han/update-design'
* han/update-design:
  update design doc

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-11 10:55:47 +00:00
Fintan Halpenny 502053d972 git-storage: remove pool
There is an advisory error[0] relating to tokio which is transitively
brought in via deadpool.

Since git-storage is not currently used and heartwood is avoiding any
async runtimes, the pool module is removed.

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

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-11 10:41:06 +00:00
Fintan Halpenny f3459cdd18 Merge remote-tracking branch 'han/fix-me'
* han/fix-me:
  remove last_commit() in Directory and File.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-11 10:19:49 +00:00
Fintan Halpenny 2bb35ed996 Merge remote-tracking branch 'han/del-git'
* han/del-git:
  promote src/git/ files to src/

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-06 11:24:37 +00:00
Fintan Halpenny 575d44e8b4 Merge remote-tracking branch 'origin/surf/remove-object-error'
* origin/surf/remove-object-error:
  surf: remove object::Error

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-05 10:50:17 +00:00
Fintan Halpenny 1d9ad1ff65 surf: remove object::Error
The Error type is no longer used thanks to the clean up of the Tree
and Blob constructions now being exposed through Repository.

Remove the Error type and clean up the imports as a result.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-04 11:05:37 +00:00
Fintan Halpenny 8d888e80c3 Merge remote-tracking branch 'origin/fix/tree-entry-cmp'
* origin/fix/tree-entry-cmp:
  surf: fix comparison of tree entries

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2023-01-04 10:59:36 +00:00
Fintan Halpenny 09a423f0d4 surf: fix comparison of tree entries
Comparing tree entries would only take into account their names. While
this is useful, it is also useful to compare by their entry kind
first, where trees take precedence over blobs.

A test is added to ensure the ordering is respected. While testing, it
was noticed that the entries aren't sorted when be passed in. When a
`Tree` is constructed it will now sort the entries first, ensure they
are given back in sorted order.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-03 11:06:53 +00:00
Fintan Halpenny 9be2c3d140 Merge remote-tracking branch 'han/rm-source'
* han/rm-source:
  remove source/ layer and file_system/ layer.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-23 09:37:44 +00:00
Fintan Halpenny 824e0d5d9b Merge remote-tracking branch 'origin/surf/revision-stats'
* origin/surf/revision-stats:
  surf: stats for a given revision

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-22 14:12:47 +00:00
Fintan Halpenny 5d7b1e4c01 surf: stats for a given revision
The `stats` method always provided the stats at the `head` of the
repository.

Introduce the `stats_from` method which takes a revision to start
from. `stats` can be defined using `stats_from` and `head`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-22 12:07:58 +00:00
Fintan Halpenny c2cc44bcc4 Merge remote-tracking branch 'origin/commit/time-accessors'
* origin/commit/time-accessors:
  git-commit: add Time accessors

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-22 10:50:18 +00:00
Fintan Halpenny 9f13cd8d07 Merge remote-tracking branch 'han/dogfood'
* han/dogfood:
  refactored Directory, File, Tree and Blob.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-22 10:49:38 +00:00
Fintan Halpenny a65ff27e22 git-commit: add Time accessors
Previously, there was no way to access the seconds and offset fields
of the Time type.

Add methods for accessing the fields.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-19 15:54:52 +00:00
Fintan Halpenny 79a9472136 Merge remote-tracking branch 'origin/fix/serialize-tree'
* origin/fix/serialize-tree:
  radicle-surf: serialize type for any kind of line
  surf: testing an added file
  surf: test serialization of tree
  surf: fix directory construction
  surf: fix path serialization for tree and blob

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-19 11:28:13 +00:00
Fintan Halpenny f4d2e38620 radicle-surf: serialize type for any kind of line
To help frontends with figuring out what kind of line is being talked
about for added and deleted files, the serialization of `Addition` and
`Deletion` always include a type. This mirrors the serialization of
the `Modification` type, which is tagged because it's an enum.

The serialization is hand-rolled since it is desirable to make sure
that added files and deleted files are only ever composed of lines
that are not modified.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-18 15:04:15 +00:00
Fintan Halpenny 21c0e68ab5 surf: testing an added file
Test the serialization of an added file in a Diff.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 11:37:59 +00:00
Fintan Halpenny 0d5b6c4c30 surf: test serialization of tree
Confirm that the serialization of `source::Tree` has the expected
output.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 11:37:59 +00:00
Fintan Halpenny 95c31f2a8e surf: fix directory construction
If a git Tree is a subtree then it no longer contains the path
information while traversing it. The traversal will only carry the
path with it if it does not skip directories, which in the case of
`entries`, it does.

To remedy this, the `path` method is used to pass the information to
`from_entry` instead.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 11:37:58 +00:00
Fintan Halpenny d957f0b1c2 surf: fix path serialization for tree and blob
The http-api code expects the 'path' serialized field to be the full
path for trees, tree entries, and blobs, i.e. the path where it is
located concatenated with the name of the entry.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 11:37:58 +00:00
Fintan Halpenny 9df4291616 Merge remote-tracking branch 'origin/nix/rust-1.66'
* origin/nix/rust-1.66:
  surf: missed expect from refactoring diff
  nix: update to rust-1.66

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-16 11:37:10 +00:00
Fintan Halpenny 01e2305a41 surf: missed expect from refactoring diff
A placeholder `.expect("TODO")` was left in the diff code while
refactoring.

Change the `expect` to `?` and use the correct `type Error`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 11:00:16 +00:00
Fintan Halpenny 8d451e3d9d nix: update to rust-1.66
Rust 1.66.0 was announced[0].

The code fixes were all for the clippy warning regarding needless
borrows.

The doc tool now parses for HTML, so any <placeholder> now needs to
be wrapped in backticks, i.e. `<placeholder>`.

[0]: https://blog.rust-lang.org/2022/12/15/Rust-1.66.0.html

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-16 10:54:55 +00:00
Fintan Halpenny 39ce2f9349 Merge remote-tracking branch 'origin/fix/ref-serde'
* origin/fix/ref-serde:
  git-ref-format: fix to deserialization
  test: add roundtrip::json_value

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-08 16:04:36 +00:00
Fintan Halpenny db7f2d40e3 git-ref-format: fix to deserialization
When deserializing through `serde_json::from_value` the following
error would occur:

  panicked at 'called Result::unwrap() on an Err value: Error("invalid
  type: string "master", expected a borrowed string", line: 0, column:
  0)'

To fix this it is necessary for the Deserialize implementations to
deserialize into an owned String and convert from there.

While attempting to test this the `Qualified` and `Namespaced`
implementations were not able to be used:

  error: implementation of `serde::de::Deserialize` is not general enough
  --> git-ref-format/t/src/properties/name.rs:86:9
   |
86 |         roundtrip::json_value(qualified);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `serde::de::Deserialize` is not general enough
   |
   = note: `Qualified<'_>` must implement `serde::de::Deserialize<'0>`, for any lifetime `'0`...
   = note: ...but `Qualified<'_>` actually implements
   `serde::de::Deserialize<'1>`, for some specific lifetime `'1`

The Deserialize for both of those types now return owned data by
returning a 'static lifetime instead.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-08 15:20:11 +00:00
Fintan Halpenny 9d137e5e7d test: add roundtrip::json_value
Adds a roundtrip helper for going to/from a json value. This can have
slightly different semantics in comparison to/from a json string.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-08 15:17:19 +00:00
Fintan Halpenny 1316a13dfc Merge remote-tracking branch 'han/fix-traits'
* han/fix-traits:
  refactoring Revision and ToCommit traits

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-06 14:03:16 +00:00
Fintan Halpenny 761e14e7cc Merge remote-tracking branch 'han/doc-comments'
* han/doc-comments:
  Updated docs, include tests in file_system.rs and fix bugs found.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-12-05 10:55:21 +00:00
Fintan Halpenny 858f13f871 Merge remote-tracking branch 'origin/surf/repo'
* origin/surf/repo:
  radicle-surf: refactor repo

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-11-30 14:22:52 +00:00
Fintan Halpenny 29f2ca337d Merge remote-tracking branch 'origin/surf/diff'
* origin/surf/diff:
  radicle-surf: refactor diff

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
2022-11-30 14:22:41 +00:00