Fixing apply (ghost channels could happen in case of error)

pmeunier
May 21, 2023, 7:49 PM
GDAKVAFRCRJ4RJSXHTZOKRZCTWCB4HKYZMUBHVVRKALWEKWRHDLQC

Dependencies

  • [2] 3XMVMFPT Fixing an error (ChannelRc) when checking that apply is nondestructive
  • [3] R3H7D42U Debugging `pijul git`: proper error reporting
  • [4] MDADYULS Fix a panic when switching between channels that have different files
  • [5] I24UEJQL Various post-fire fixes
  • [6] 26VQKD25 A more accurate safeguard for apply, to check if the output is nondestructive
  • [7] Y6EVFMTA Don't output files if they aren't in the current channel
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [9] XA23FMQM Reset only files that have been modified
  • [10] LGEJSLTY Fixing output (including its uses in reset and pull)
  • [11] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [12] ISZ65SPQ Checking that `pijul apply` does not destroy unrecorded changes

Change contents

  • replacement in pijul/src/commands/apply.rs at line 61
    [3.54][3.54:362]()
    // Channel used to check if we can output the repo.
    let forked_s: String = rand::thread_rng()
    .sample_iter(&rand::distributions::Alphanumeric)
    .take(20)
    .map(char::from)
    .collect();
    let forked = txn.write().fork(&channel, &forked_s)?;
    [3.54]
    [3.816]
    // Forked channel before the apply, in order to check whether
    // we are overwriting a path.
    let forked = if is_current_channel {
    let forked_s: String = rand::thread_rng()
    .sample_iter(&rand::distributions::Alphanumeric)
    .take(20)
    .map(char::from)
    .collect();
    let forked = txn.write().fork(&channel, &forked_s)?;
    Some((forked_s, forked))
    } else {
    None
    };
  • replacement in pijul/src/commands/apply.rs at line 129
    [3.23732][3.2923:2955](),[3.1107][3.2923:2955]()
    if is_current_channel {
    [3.1107]
    [3.2955]
    if let Some((_, ref forked)) = forked {
  • edit in pijul/src/commands/apply.rs at line 188
    [3.1512][3.560:585](),[3.585][2.0:44](),[2.44][3.585:643](),[3.585][3.585:643]()
    } else {
    std::mem::drop(forked);
    txn.write().drop_channel(&forked_s)?;
  • edit in pijul/src/commands/apply.rs at line 227
    [3.1652]
    [3.196314]
    if let Some((forked_s, forked)) = forked {
    std::mem::drop(forked);
    txn.write().drop_channel(&forked_s)?;
    }