Add reset_overwrites_changes config option. When set to never --force is required for reset

ryanbooker
Jan 8, 2024, 12:17 PM
ICEK2JVGXK2GQH7AYKPDFACBLRGZDQQS4Y4AB7K3B7V4C6C6AJPAC

Dependencies

  • [2] RUBBHYZ7 Removing unnecessary async/await
  • [3] FVU3Y2U3 Adding a local "unrecord_changes" option in addition to the global one
  • [4] VQPAUKBQ channel switch as an alias to reset
  • [5] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [*] SLJ3OHD4 unrecord: show list of changes if none were given as arguments
  • [*] 5BB266P6 Optional colours in the global config file
  • [*] 5OGOE4VW Store the current channel in the pristine
  • [*] EUZFFJSO Updating Pijul with the latest changes in Libpijul

Change contents

  • edit in pijul/src/config.rs at line 14
    [7.822]
    [8.0]
    pub reset_overwrites_changes: Option<Choice>,
  • edit in pijul/src/config.rs at line 139
    [3.41]
    [8.252]
    pub reset_overwrites_changes: Option<Choice>,
  • replacement in pijul/src/commands/reset.rs at line 34
    [2.1186][2.1186:1211]()
    self.reset(true)
    [2.1186]
    [4.472]
    let reset_overwrites_changes = crate::config::Global::load()
    .ok()
    .and_then(|c| c.0.reset_overwrites_changes);
    let overwrite_changes = match reset_overwrites_changes.as_ref() {
    Some(crate::config::Choice::Never) => false,
    Some(crate::config::Choice::Auto) | Some(crate::config::Choice::Always) | _ => true,
    };
    self.reset(overwrite_changes)
  • edit in pijul/src/commands/reset.rs at line 148
    [9.1334]
    [10.3996]
    if !overwrite_changes && !self.force {
    writeln!(stderr, "Unrecorded changes will be lost")?;
    writeln!(
    stderr,
    "Use --force to reset repository to last recorded change"
    )?;
    return Ok(());
    }