Writing an initial config file at initialisation

pmeunier
Jan 1, 2022, 3:18 PM
OPC2VAZDO4HL6K4BBNQP5A5YD2DI6UYI7O7ZQWAGLU7Z662PEOBAC

Dependencies

  • [2] H72JG6HL Init feature; specific .ignore configs
  • [3] AOKPEHAJ Fixing the `pijul git` command with the new init
  • [4] LYTVEPH3 Avoid cloning into an existing path
  • [5] NEJOYVJB Fixing the Git feature
  • [6] ZBNKSYA6 Fixing a bus error when starting a transaction on a full disk
  • [7] VGBH3ED6 The Git feature does not need to be async
  • [8] B3QWIGDE Fixing the Git features with the latest Pijul (+ conflicts in Cargo.toml)
  • [9] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [10] SQVWP4LU When clone fails, only remove directories we have created (not other directories)
  • [11] Q7CHNDXN Init repo with default .ignore file
  • [12] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [13] JL4WKA5P Implement the Sanakirja concurrency model in a cross-process way
  • [14] RUBBHYZ7 Removing unnecessary async/await
  • [15] RGJWLQWB When cloning, try to init *before* setting up the path Drop (pijul::commands::clone::RepoPath)

Change contents

  • replacement in pijul/src/repository.rs at line 111
    [2.406][2.406:437]()
    kind: Option<&String>,
    [2.406]
    [2.437]
    kind: Option<&str>,
    remote: Option<&str>,
  • edit in pijul/src/repository.rs at line 128
    [2.526]
    [4.275]
    init_default_config(&cur, remote)?;
  • edit in pijul/src/repository.rs at line 152
    [4.465]
    [4.465]
    fn init_default_config(path: &std::path::Path, remote: Option<&str>) -> Result<(), anyhow::Error> {
    use std::io::Write;
    let mut path = path.join(DOT_DIR);
    path.push("config");
    if std::fs::metadata(&path).is_err() {
    let mut f = std::fs::File::create(&path)?;
    if let Some(rem) = remote {
    writeln!(f, "default_remote = {:?}", rem)?;
    }
    writeln!(f, "[hooks]\nrecord = []")?;
    }
    Ok(())
    }
  • replacement in pijul/src/repository.rs at line 168
    [4.608][2.527:642]()
    fn init_dot_ignore(
    base_path: std::path::PathBuf,
    kind: Option<&String>,
    ) -> Result<(), anyhow::Error> {
    [4.608]
    [4.689]
    fn init_dot_ignore(base_path: std::path::PathBuf, kind: Option<&str>) -> Result<(), anyhow::Error> {
  • replacement in pijul/src/repository.rs at line 198
    [2.869][2.869:896]()
    kind: Option<&String>,
    [2.869]
    [2.896]
    kind: Option<&str>,
  • replacement in pijul/src/commands/init.rs at line 24
    [4.1824][2.1581:1650]()
    let repo = Repository::init(self.path, self.kind.as_ref())?;
    [4.1824]
    [4.512]
    let repo = Repository::init(self.path, self.kind.as_deref(), None)?;
  • replacement in pijul/src/commands/git.rs at line 47
    [4.138216][3.0:60]()
    Repository::init(self.repo_path.clone(), None)?
    [4.138216]
    [4.138270]
    Repository::init(self.repo_path.clone(), None, None)?
  • replacement in pijul/src/commands/clone.rs at line 75
    [4.167][2.1651:1711]()
    let mut repo = Repository::init(Some(path), None)?;
    [4.167]
    [4.16742]
    let mut repo = Repository::init(Some(path), None, Some(&self.remote))?;