Current state: return zero instead of an Option if there is no change on the channel

[?]
Dec 15, 2020, 10:29 AM
6RVT5X4LTRP5XHVDESXMIC2DHMT5MUQ24ZDWEBJ4XYTF6LJXK7CAC

Dependencies

  • [2] VO5OQW4W Removing anyhow in libpijul
  • [3] CVAT6LN3 Fixing git import, and adding more useful feedback (with `RUST_LOG="pijul=info"`)
  • [4] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [5] WZVCLZKY address clippy lints
  • [6] R3H7D42U Debugging `pijul git`: proper error reporting
  • [7] BXD3IQYN Fixing --features git
  • [8] I52XSRUH Massive cleanup, and simplification

Change contents

  • replacement in pijul/src/commands/protocol.rs at line 201
    [3.131779][3.131779:131876]()
    if txn.current_state(&channel.borrow()) == Some(state) && extra.is_empty() {
    [3.131779]
    [3.131876]
    if txn.current_state(&channel.borrow()) == state && extra.is_empty() {
  • replacement in pijul/src/commands/git.rs at line 651
    [2.404][2.404:474]()
    return Ok(txn.current_state(&channel.borrow()).unwrap());
    [2.404]
    [2.474]
    return Ok(txn.current_state(&channel.borrow()));
  • replacement in pijul/src/commands/git.rs at line 676
    [3.160242][3.160242:160306](),[3.160306][3.333:434](),[3.434][3.160364:160370](),[3.160364][3.160364:160370]()
    if let Some(state) = state {
    Ok(state)
    } else {
    Ok(txn
    .current_state(&channel.borrow())
    .unwrap_or(Merkle::zero()))
    }
    [3.160242]
    [3.160370]
    Ok(state)
  • replacement in pijul/src/commands/git.rs at line 736
    [3.161804][3.161804:161837]()
    Ok((n, Some(hash), Some(m)))
    [3.161804]
    [3.161837]
    Ok((n, Some(hash), m))
  • replacement in libpijul/src/pristine/mod.rs at line 392
    [3.40230][3.40230:40252]()
    ) -> Option<Merkle> {
    [3.40230]
    [3.40252]
    ) -> Merkle {
  • edit in libpijul/src/pristine/mod.rs at line 396
    [3.40357]
    [3.40357]
    .unwrap_or(Merkle::zero())
  • replacement in libpijul/src/lib.rs at line 405
    [3.730331][3.60805:60898]()
    fn current_state(&self, channel: &pristine::Channel<Self>) -> Option<pristine::Merkle> {
    [3.730331]
    [3.60898]
    fn current_state(&self, channel: &pristine::Channel<Self>) -> pristine::Merkle {