Refactor Repository constructors to take Option<&Path> instead of Option<PathBuf>

dblsaiko
Mar 29, 2024, 5:46 PM
GKSVBEUW7Q2M4QPKPHOUPGP36AMXMJVGX7KCSNYXEFQZOURGBSMQC

Dependencies

  • [2] E6IKUIPD Command to delete a tag
  • [3] FCMAW4GO Canonicalise the source path when cloning a local source
  • [4] YXAVFTPP Allowing vertex buffer to use references to the transaction, by changing `output::output` to take an ArcTxn<T> instead of a simple T
  • [5] GYGLQPVX Migrate from `pijul::current_dir` to `std::env::current_dir`
  • [6] OGJFEWHU Fixing missing dependencies on partial clones
  • [7] TFK7CYFQ `pijul channel new` to create new, empty channels
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [9] A3RM526Y Integrating identity malleability
  • [10] FZ7MXL3B Allow to use short tag hashes
  • [11] Q7CHNDXN Init repo with default .ignore file
  • [12] GUL4M5FI Cleanup and formatting
  • [13] VQPAUKBQ channel switch as an alias to reset
  • [14] JL4WKA5P Implement the Sanakirja concurrency model in a cross-process way
  • [15] ZBNKSYA6 Fixing a bus error when starting a transaction on a full disk
  • [16] OMTQVGUE Adjust pijul init to not modify existing .ignore files
  • [17] LBVUI6AX Rename `ls` command to `list`
  • [18] YK7EBTF6 Safeguarding `pijul channel new`: it was too easy to create a new, independent root
  • [19] DO2Y5TY5 Tag synchronisation
  • [20] VWJ2JL63 Adding a `pijul dependents` command to list the transitive closure of the reverse dependency relation
  • [21] WCA7X6W6 Create `pijul-repository` crate
  • [22] GHO6DWPI Refactoring iterators
  • [23] DDJO7X2P Remove dependency on `num_cpus`
  • [24] 3OPNBBAU Migrate from `pijul::remote` to `pijul_remote`
  • [25] RUBBHYZ7 Removing unnecessary async/await
  • [26] QQS7LII4 Add value hints to arguments
  • [27] 5OGOE4VW Store the current channel in the pristine
  • [28] 367UBQ6K Forwarding SSH stderr, and progress bar for push
  • [29] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [30] I24UEJQL Various post-fire fixes
  • [31] IVLLXQ5Z Improved push/pull reporting
  • [32] H72JG6HL Init feature; specific .ignore configs
  • [33] ZDK3GNDB Tag transactions (including a massive refactoring of errors)
  • [34] 6F6AAHK4 Simplifying pijul::commands::log, and fixing Broken Pipe errors
  • [35] DX2FO4HZ Tag CLI cleanup
  • [36] U6TQX5Z2 pager function respects cli option and user config files, PAGER env var
  • [37] DWSAYGVE Update codebase to use new identity management
  • [38] TYAKEAJL A better estimate of the maximum number of open patches we can keep (Unix-only at the moment)
  • [39] UAXGGNAZ Improve command feedback
  • [40] RFLKHQ2Y First read all stdin when applying a patch, in order to avoid blocking
  • [41] 76PCXGML Pushing to, and pulling from the local repository
  • [42] STOFOQI4 Fixing a bug in `pijul dependents` where non-dependents could be listed (and making the command deterministic)
  • [43] J2OHO7RA Solving a conflict (due to the new conflict detection algorithm)
  • [44] Y2Y4OOIE Move `pijul::DEFAULT_CHANNEL` to `libpijul`
  • [45] YN63NUZO Sanakirja 1.0
  • [46] AAXP2534 Tags: completing the subcommand
  • [47] 3AMEP2Y5 More convenient interface for channels
  • [48] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [49] FDEVV5NG Tag check
  • [50] PGERZ3KJ Channel renaming (also do not create a new channel when recording on a channel that doesn't exist)
  • [51] L3RCAPPK Add --repository to tag commands
  • [52] VMPAOJS2 Don't output after pushing to a local channel
  • [53] OPC2VAZD Writing an initial config file at initialisation
  • [54] QL6K2ZM3 Tags
  • [*] TEDGMEHF Introduce subcommand for completion-script generation.

Change contents

  • edit in pijul-repository/src/lib.rs at line 1
    [7.21431]
    [5.0]
    use std::borrow::Cow;
  • replacement in pijul-repository/src/lib.rs at line 3
    [5.27][7.21516:21540](),[7.21516][7.21516:21540]()
    use std::path::PathBuf;
    [5.27]
    [7.21540]
    use std::path::{Path, PathBuf};
  • replacement in pijul-repository/src/lib.rs at line 49
    [7.22284][7.22284:22375]()
    fn find_root_(cur: Option<PathBuf>, dot_dir: &str) -> Result<PathBuf, anyhow::Error> {
    [7.22013]
    [7.22375]
    fn find_root_(cur: Option<&Path>, dot_dir: &str) -> Result<PathBuf, anyhow::Error> {
  • replacement in pijul-repository/src/lib.rs at line 51
    [7.22422][7.22422:22438]()
    cur
    [7.22422]
    [7.22438]
    cur.to_path_buf()
  • replacement in pijul-repository/src/lib.rs at line 72
    [7.22907][7.0:76]()
    pub fn find_root(cur: Option<PathBuf>) -> Result<Self, anyhow::Error> {
    [7.22907]
    [7.76]
    pub fn find_root(cur: Option<&Path>) -> Result<Self, anyhow::Error> {
  • replacement in pijul-repository/src/lib.rs at line 77
    [7.163][7.23076:23106](),[7.1279][7.23076:23106](),[7.23076][7.23076:23106]()
    cur: Option<PathBuf>,
    [7.163]
    [7.23106]
    cur: Option<&Path>,
  • replacement in pijul-repository/src/lib.rs at line 81
    [7.23219][7.23219:23466]()
    let mut pristine_dir = cur.clone();
    pristine_dir.push(PRISTINE_DIR);
    let mut changes_dir = cur.clone();
    changes_dir.push(CHANGES_DIR);
    let mut working_copy_dir = cur.clone();
    working_copy_dir.pop();
    [7.23219]
    [7.23466]
    let pristine_dir = cur.join(PRISTINE_DIR);
    let changes_dir = cur.join(CHANGES_DIR);
    let working_copy_dir = cur.parent().unwrap();
  • replacement in pijul-repository/src/lib.rs at line 104
    [7.24220][7.24220:24256]()
    path: working_copy_dir,
    [7.24220]
    [7.24256]
    path: working_copy_dir.to_path_buf(),
  • replacement in pijul-repository/src/lib.rs at line 110
    [7.364][7.364:406]()
    path: Option<std::path::PathBuf>,
    [7.364]
    [7.0]
    path: Option<&Path>,
  • replacement in pijul-repository/src/lib.rs at line 117
    [7.24427][7.24427:24444]()
    path
    [7.24427]
    [7.24444]
    Cow::Borrowed(path)
  • replacement in pijul-repository/src/lib.rs at line 119
    [7.24461][7.24461:24488]()
    current_dir()?
    [7.24461]
    [7.24488]
    Cow::Owned(current_dir()?)
  • replacement in pijul-repository/src/lib.rs at line 121
    [7.24499][7.65:231]()
    let pristine_dir = {
    let mut base = cur.clone();
    base.push(DOT_DIR);
    base.push(PRISTINE_DIR);
    base
    };
    [7.24499]
    [7.24620]
    let pristine_dir = cur.join(DOT_DIR).join(PRISTINE_DIR);
  • replacement in pijul-repository/src/lib.rs at line 126
    [7.24728][7.477:526]()
    init_dot_ignore(cur.clone(), kind)?;
    [7.24728]
    [7.59]
    init_dot_ignore(&cur, kind)?;
  • replacement in pijul-repository/src/lib.rs at line 128
    [7.107][7.275:463](),[7.526][7.275:463](),[7.275][7.275:463]()
    let changes_dir = {
    let mut base = cur.clone();
    base.push(DOT_DIR);
    base.push(CHANGES_DIR);
    base
    };
    [7.107]
    [7.30]
    let changes_dir = cur.join(DOT_DIR).join(CHANGES_DIR);
  • replacement in pijul-repository/src/lib.rs at line 142
    [7.25208][7.25208:25235]()
    path: cur,
    [7.25208]
    [7.25235]
    path: cur.into_owned(),
  • replacement in pijul-repository/src/lib.rs at line 159
    [7.465][7.108:208]()
    fn init_default_config(path: &std::path::Path, remote: Option<&str>) -> Result<(), anyhow::Error> {
    [7.465]
    [7.208]
    fn init_default_config(path: &Path, remote: Option<&str>) -> Result<(), anyhow::Error> {
  • replacement in pijul-repository/src/lib.rs at line 175
    [7.608][7.559:660]()
    fn init_dot_ignore(base_path: std::path::PathBuf, kind: Option<&str>) -> Result<(), anyhow::Error> {
    [7.608]
    [7.689]
    fn init_dot_ignore(base_path: &Path, kind: Option<&str>) -> Result<(), anyhow::Error> {
  • replacement in pijul-repository/src/lib.rs at line 177
    [7.713][7.713:833]()
    let dot_ignore_path = {
    let mut base = base_path.clone();
    base.push(".ignore");
    base
    };
    [7.713]
    [7.833]
    let dot_ignore_path = base_path.join(".ignore");
  • replacement in pijul/src/commands/unrecord.rs at line 35
    [7.1080][7.13337:13400](),[7.5722][7.13337:13400]()
    let mut repo = Repository::find_root(self.repo_path)?;
    [7.1080]
    [7.96236]
    let mut repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/tag.rs at line 96
    [7.92][7.532:598]()
    let mut repo = Repository::find_root(repo_path)?;
    [7.92]
    [7.2428]
    let mut repo = Repository::find_root(repo_path.as_deref())?;
  • replacement in pijul/src/commands/tag.rs at line 143
    [7.113][7.627:689]()
    let repo = Repository::find_root(repo_path)?;
    [7.113]
    [7.150]
    let repo = Repository::find_root(repo_path.as_deref())?;
  • replacement in pijul/src/commands/tag.rs at line 168
    [7.5659][7.5659:5721]()
    let repo = Repository::find_root(repo_path)?;
    [7.5659]
    [7.369]
    let repo = Repository::find_root(repo_path.as_deref())?;
  • replacement in pijul/src/commands/tag.rs at line 206
    [2.820][2.820:882]()
    let repo = Repository::find_root(repo_path)?;
    [2.820]
    [2.882]
    let repo = Repository::find_root(repo_path.as_deref())?;
  • replacement in pijul/src/commands/tag.rs at line 237
    [7.268][7.26544:26611]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.268]
    [7.440]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/reset.rs at line 56
    [7.98218][7.13851:13910]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.98218]
    [7.3338]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/record.rs at line 73
    [7.536][7.13911:13978](),[7.1422][7.13911:13978](),[7.102832][7.13911:13978]()
    let repo = Repository::find_root(self.repo_path.clone())?;
    [7.536]
    [7.102903]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/pushpull.rs at line 184
    [7.1475][7.14593:14652](),[7.6472][7.14593:14652]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.1475]
    [7.112314]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/pushpull.rs at line 501
    [7.1981][7.20068:20135]()
    let repo = Repository::find_root(self.repo_path.clone())?;
    [7.1981]
    [7.114570]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/pushpull.rs at line 693
    [7.117585][7.21787:21858]()
    let mut repo = Repository::find_root(self.repo_path.clone())?;
    [7.117585]
    [7.9020]
    let mut repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/protocol.rs at line 55
    [7.1528][7.15774:15837](),[7.6860][7.15774:15837]()
    let mut repo = Repository::find_root(self.repo_path)?;
    [7.1528]
    [6.3472]
    let mut repo = Repository::find_root(self.repo_path.as_deref())?;
  • edit in pijul/src/commands/mod.rs at line 2
    [7.19773]
    [7.19773]
    mod common_opts;
  • edit in pijul/src/commands/mod.rs at line 74
    [56.155]
    [56.155]
  • replacement in pijul/src/commands/log.rs at line 60
    [7.245][7.245:311]()
    let repo = Repository::find_root(cmd.repo_path.clone())?;
    [7.245]
    [7.354]
    let repo = Repository::find_root(cmd.repo_path.as_deref())?;
  • replacement in pijul/src/commands/init.rs at line 25
    [7.1824][7.686:763]()
    let repo = Repository::init(self.path, self.kind.as_deref(), None)?;
    [7.1824]
    [7.512]
    let repo = Repository::init(self.path.as_deref(), self.kind.as_deref(), None)?;
  • replacement in pijul/src/commands/fork.rs at line 28
    [7.1926][7.23679:23738](),[7.14628][7.23679:23738]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.1926]
    [7.168420]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/file_operations.rs at line 97
    [7.2036][7.23807:23866](),[7.14968][7.23807:23866]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.2036]
    [7.170979]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/diff.rs at line 42
    [7.2199][7.24003:24070](),[7.15461][7.24003:24070]()
    let repo = Repository::find_root(self.repo_path.clone())?;
    [7.2199]
    [7.15999]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/dependents.rs at line 20
    [7.759][7.759:826]()
    let repo = Repository::find_root(self.repo_path.clone())?;
    [7.759]
    [7.826]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/debug.rs at line 22
    [7.2252][7.24133:24192](),[7.15597][7.24133:24192]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.2252]
    [7.178130]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/credit.rs at line 30
    [7.179239][7.24247:24306]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.179239]
    [4.999]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/clone.rs at line 85
    [3.321][3.321:407]()
    let mut repo = Repository::init(Some(path), None, Some(&remote_normalised))?;
    [3.321]
    [7.16742]
    let mut repo = Repository::init(Some(&path), None, Some(&remote_normalised))?;
  • replacement in pijul/src/commands/channel.rs at line 53
    [7.187735][7.24512:24579]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.187735]
    [7.187735]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/channel.rs at line 67
    [7.188244][7.24580:24647]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.188244]
    [7.3917]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/channel.rs at line 89
    [7.188456][7.24648:24715]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.188456]
    [7.960]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/channel.rs at line 112
    [7.391][7.24716:24783](),[7.155][7.24716:24783]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.391]
    [7.228]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/change.rs at line 21
    [7.2495][7.24784:24851](),[7.16397][7.24784:24851]()
    let repo = Repository::find_root(self.repo_path.clone())?;
    [7.2495]
    [7.189800]
    let repo = Repository::find_root(self.repo_path.as_deref())?;
  • replacement in pijul/src/commands/archive.rs at line 100
    [7.8987][7.24875:24949]()
    if let Ok(repo) = Repository::find_root(self.repo_path.clone()) {
    [7.8987]
    [7.193066]
    if let Ok(repo) = Repository::find_root(self.repo_path.as_deref()) {
  • replacement in pijul/src/commands/apply.rs at line 27
    [7.2548][7.24950:25009](),[7.16631][7.24950:25009]()
    let repo = Repository::find_root(self.repo_path)?;
    [7.2548]
    [7.407]
    let repo = Repository::find_root(self.repo_path.as_deref())?;