Commit Graph

2470 Commits

Author SHA1 Message Date
Lorenz Leutgeb 876d22b072 remote-helper: Remove unused push error variant 2025-09-15 10:21:09 +01:00
Lorenz Leutgeb 550fcccc27 remote-helper: Do not hard-code binary name 2025-09-15 10:21:09 +01:00
Lorenz Leutgeb 897404164b remote-helper: Make crate binary-only
This crate is not a library, i.e., it is not intended to be depended
upon by other crates. Rather, it implements the `git-remote-rad`
binary.

Reflect this by moving `lib.rs` to `main.rs`, merging it with
`git-remote-rad.rs`.
2025-09-15 10:21:09 +01:00
Fintan Halpenny 66adbffd61 term: Use static template in spinner initialization
Use `static` + `LazyLock` to ensure that the templates evaluation only
happens once and the value can be re-used on each subsequent access.
2025-09-15 11:17:35 +02:00
Erik Kundt 8fc37e3316 term: Move to indicatif spinner
This fixes line flodding on narrow terminals and a missing cursor after
cancelation by replacing the custom spinner with an indicatif spinner.
2025-09-15 11:17:35 +02:00
Erik Kundt ee9ecfda76 remote-helper: Remove `SyncWriter` in favor of `PaintTarget` 2025-09-15 11:17:35 +02:00
Erik Kundt 153a8f9fbe node: Remove `SyncWriter` in favor of `PaintTarget` 2025-09-15 11:17:35 +02:00
Erik Kundt 11a109ef41 term: Introduce `PaintTarget`
This introduces a `PaintTarget`, that defines the stream an operation
uses to draw to (`stdout`, `stderr`, `sink`). It will be used in
subsequent commits to configure the new spinner.
2025-09-15 11:17:35 +02:00
Lorenz Leutgeb 379037956a remote-helper: Prevent doubly verifying each push
The context of the invocation of `git push` "internally" by the
remote helper is the same as by the user invoking `git push` most
of the time. That is, these pushes run within the same repository,
thus the configuration for pre-push hooks applies to both. This
leads to every push being verified *twice*.

If the user intends to configure pre-push hooks, then they would
do that on the remote with URL `rad://…`, and so the hook would
be executed before `git-remote-rad` even gets called.

We thus specify `--no-verify` to not verify again.
2025-09-11 16:59:12 +01:00
Lorenz Leutgeb a0f6cbf5f1 radicle: Move interpretation of output to binary
`radicle::git::run` interprets the `Output` returned by the `git`
process. However, depending on the application we have different
requirements for interpreting the output, e.g., how to handle errors.

Make `radicle::git::run` not interpret `Output`, but move this
logic to the respective binary crates (`radicle-remote-helper` and
`radicle-cli`).
2025-09-11 16:59:12 +01:00
Lorenz Leutgeb 0a8317c35f remote-helper: Interpret verbosity option
The `verbosity` option is ignored, which makes it more difficult to
obtain debugging information if the "internal" push, i.e., the
`git push` invocation by `git-remote-rad` fails.

Provide two types for verbosity, and wire them up.
2025-09-11 16:59:12 +01:00
Fintan Halpenny 11e8b89b20 radicle/src/git: additionally specify pruneTags for remote
Ensure that, when adding a remote, `pruneTags` is set to `false` so
that tags are not pruned when fetching from a remote's namespace.
2025-09-11 11:25:34 +01:00
Matthias Beyer 646d4360e7 cli/node: Replace manual pushing with Table::extend()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:29:47 +02:00
Matthias Beyer 2f28232676 cli/issue: Replace manual pushing with Table::extend()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:29:36 +02:00
Matthias Beyer 8554e996b8 cli/diff: Replace manual pushing with Table::extend()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:28:53 +02:00
Matthias Beyer fbef60eed6 cli/sync: Replace manual pushing with Table::extend()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:27:59 +02:00
Matthias Beyer 370ae3643a cli/patch: Replace manual iterator partitioning with Itertools::partition_result()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:40 +02:00
Matthias Beyer 3f489354b6 cli: Add itertools dependency
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:30 +02:00
Matthias Beyer 9c2f97abe1 cli/remote: Replace manual building table from iterator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:30 +02:00
Matthias Beyer 4bd45cdabd cli/inbox: Replace manual building table from iterator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:30 +02:00
Matthias Beyer 016cab1dbf term/table: Add Table::with_opts() to set options after Table obj was constructed
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:30 +02:00
Matthias Beyer fb458537b4 cli/patch: Replace manual building table from iterator
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:30 +02:00
Matthias Beyer 41a742ed9b term/table: Add impl FromIterator for Table
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-10 21:23:28 +02:00
Matthias Beyer ff021d5889 cli: Rewrite `#[path="…"]` module declarations
Rewrite module declarations that use the `#[path="…"]` annotation
to the more idomatic `pub mod …` + `pub use …` forms.

For the "self" module, that is not possible because `self` is an
identifier in Rust, and also `r#self` is not admissable as a raw
identifier, so stick to `rad_self`.

Files in submodules were patched as appropriate.
2025-09-10 21:09:29 +02:00
Matthias Beyer 11fc98c9c9
term: Replace manual Extend impl for Table
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-09-07 12:39:32 +02:00
Lorenz Leutgeb f00d1d6743 cli/self: Stop printing information about the node
To get to a point of separating the users' identity from the node, then the `rad
self` command should not display information related to the node so prominently.

The relation between `rad` and `radicle-node` is really similar to that between
`rad` and SSH Agent. They communicate via socket. So, when this connection is
successful, it is printed, but not more.

There may be some re-learning for users here, but it is worth the improvement.

Note that the information being removed here is available via `rad node status`
(see previous commit).
2025-09-04 17:12:19 +03:00
Lorenz Leutgeb e1af550a09 cli/node: Print Node ID
If we ever want to disentangle the users' identity from the node, then
the `rad node` commands must learn to print the information related to
the node, so here we go.
2025-09-04 17:12:19 +03:00
Lorenz Leutgeb 9b7529baa7 hooks: Filter for "radicle.{xyz,zulipchat.com}"
This hook should make people think before committing domain names
like "radicle.xyz" and "radicle.zulipchat.com" to our Rust code.

Note that these checks can be easily skipped as follows:

    SKIP=grep-radicle.xyz,grep-radicle.zulipchat.com git commit …

See also <https://pre-commit.com/#temporarily-disabling-hooks>
2025-09-04 16:44:05 +03:00
Lorenz Leutgeb b301fa6a00 doc: Mention handling of "radicle.xyz" 2025-09-04 16:44:05 +03:00
Lorenz Leutgeb 79505fa905 radicle/test/fixtures: Use "radicle.xyz" as `const`
Ideally, we would like to use a name that is compliant with RFC 2606,
such as "radicle.example.com", but this would change *lots* of hashes,
which is not worth the hassle.

Instead, make changing this in the future as easy as changing one
constant.
2025-09-04 16:44:05 +03:00
Lorenz Leutgeb 1a3fda547a radicle/explorer: Allow overriding default URL
This makes the default Radicle Explorer URL configurable at compile-time
via the environment variable `RADICLE_EXPLORER`.

In order to stay backwards compatible, we still default to
"app.radicle.xyz"
2025-09-04 16:44:05 +03:00
Lorenz Leutgeb e2c476a387 radicle/test: Don't hard-code "radicle.xyz" 2025-09-04 16:44:05 +03:00
Lorenz Leutgeb 2127782b74 term: Remove dependency on `anyhow`
As a library crate, it is bad to return such generic errors.

To get there, errors from `inquire` are downcasted.

This allowed to clean up the public interface of `radicle-term`, so that
it does also not leak the `inquire::InquireError` in its public API.
2025-09-04 16:28:20 +03:00
Lorenz Leutgeb edd88a59bf term: Remove `mod command`
This is dead code that imports `anyhow`. On the way to removing the
dependency on `anyhow` from `radicle-term`, it just seems to be a good
idea to remove the cruft.
2025-09-04 16:28:20 +03:00
Lorenz Leutgeb 79d928551b node: Remove dependency on `anyhow`
`anyhow` is only used to capture a handful of errors. It also turns out that
usage of `lexopt` was wrong, since it features `parse_with`, which neatly
integrates with `FromStr`. The types, luckily, implement this trait already –
making for cleaner parsing.

For now, the execution errors are all "transparent", which shouldn't be
much of a regression, if at all.
2025-09-04 16:28:20 +03:00
Lorenz Leutgeb 4bf3ab6fb8 github/actions: Add a workflow to build
Since we're eyeing at a Windows build, we should also have some CI
system build on Windows, so that developers that do not run it can
access build logs.

Most of the builds currently fail, but that's okay, the intention is
that they become more green over time.

If you are ever spammed by notifications about these on GitHub, disable
these at https://github.com/settings/notifications (scroll to "System"
and the row "Actions").
2025-09-04 15:43:36 +03:00
Matthias Beyer 55cdd880bf radicle-term: Pass in `mut self` rather than rebinding
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:18:33 +02:00
Matthias Beyer 19c484e956 radicle-term: Optimize impl of VStack::children()
This way the Iterator::size_hint() function can be used by the
Extend::extend() implementation, which might safe reallocations for
the underlying buffer.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:18:33 +02:00
Matthias Beyer 93388e366c radicle-term: Preallocate in Line::spaced()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:18:33 +02:00
Matthias Beyer 3036509e42 radicle-term: Add testcase for Line::spaced()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:13:32 +02:00
Matthias Beyer 23b9d30639 radicle: Remove unnecessary clone()
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:13:32 +02:00
Matthias Beyer 29a95fb1a6 radicle-fetch: Replace manual std::matches!() impl
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
2025-08-27 23:12:50 +02:00
Lorenz Leutgeb ded0d19d59 protocol/wire/test: Define `fn roundtrip` and macro
In many tests we assert that encoding and decoding gives the same
object. Let's call that a "roundrip", and also provide a proc macro to
generate such tests.
2025-08-27 12:48:11 +02:00
Fintan Halpenny bbd1e2cff6 crates: 1.4.0 release
Update crate versions for the 1.4.0 release
2025-08-27 10:30:28 +01:00
Fintan Halpenny de38d97418 build: move to use `releases/` prefix
The team decided to use `releases/*.*.*` for the naming scheme of release tags.

This change needs to be reflected in the `build` tooling as well.
2025-08-27 10:30:28 +01:00
Lorenz Leutgeb 819ae5fdf5 node/main: Refactor initialization of logging
It turns out that failing to read configuration resulted in no output,
because the logger would only be set after configuration had been read.

Fix this, by setting the logger early, with a log level that is then
corrected as soon as configuration is available.

While at it, also clean this up to allow logging errors about failure to
set up the logger.
2025-08-27 11:17:18 +02:00
Lorenz Leutgeb bc4a13902c systemd: Clean up default service configurations
Restructure, unify the style of the two files, refer to documentation
instead of repeating part of it.
2025-08-26 20:25:08 +02:00
srestegosaurio 25decf1617 systemd: Add example service hardening
Include some trivial sandboxing options in the provided service files
as an example and lead users to `systemd-analyze security`.

While being a trivial change and far from a secure service it is an
improvement and may push downstream packagers and/or users to add even
a bit of sandboxing.

Signed-off-by: srestegosaurio <lcdt@disroot.org>
2025-08-26 20:25:08 +02:00
Lorenz Leutgeb d7aa2d9da2 flake/hooks: Reconfigure Git Hooks
1. Introduce a new hook to run `cargo doc` in the "pre-commit"
    phase. We have to resort to wrapping the command in a shell
    script, since we cannot configure environment variables via
    `.pre-commit.yaml` but need `RUSTDOCFLAGS` so that `cargo doc`
    actually exists non-zero when there are warnings.
 2. Move `cargo check` from the "pre-push" to the "pre-commit"
    phase, as it is relatively quick, and redundant to run before
    `clippy`.
 3. Let `cargo check` and `cargo doc` run after `rustfmt`.
 4. Let a failure of `rustfmt` fail the whole check.
 5. Wire through `packageOverrides` to `rustfmt` so we use the
    same toolchain as the other tools.
 6. Additionally enable `cargo clippy` to consider all features.
2025-08-25 21:51:01 +02:00
Fintan Halpenny 7d2f0e387c node: e2e test for canonical ref update
Adds a test to ensure that canonical reference updates are received on the node
events stream.

Added a helper to `NodeHandle` for perfoming a commit to a reference and signing
the nodes references, to help with this use case.
2025-08-25 18:49:43 +01:00