In `pijul git`, avoid diffing files not modified by a commit

pmeunier
Oct 18, 2022, 7:48 AM
FF4TXHN5T4QFIUI4MNCWZYNV6D5F5K5JKPBESN3EPP5YHLHSYI5AC

Dependencies

  • [2] WFXSB6RA Do not run `pijul git` if there are uncommitted changes
  • [3] OPC2VAZD Writing an initial config file at initialisation
  • [4] RP7YRM5Q Import Git repos without writing anything to disk
  • [5] S7MPXAPH Removing warnings in pijul::commands::git
  • [6] CVAT6LN3 Fixing git import, and adding more useful feedback (with `RUST_LOG="pijul=info"`)
  • [7] I52XSRUH Massive cleanup, and simplification
  • [8] RHHNPMZI Fixing `pijul git`
  • [9] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [10] JL4WKA5P Implement the Sanakirja concurrency model in a cross-process way
  • [11] BJOZ25EU Deterministic Git import
  • [12] VU4KVXHW Git import was importing parents and hidden files (including .git), in some cases
  • [13] GUL4M5FI Cleanup and formatting
  • [14] NEJOYVJB Fixing the Git feature
  • [15] VGBH3ED6 The Git feature does not need to be async
  • [16] 2RXOCWUW Making libpijul deterministic (and getting rid of `rand`)
  • [17] GBLM3JLR Fix options of git subcommand
  • [18] LGEJSLTY Fixing output (including its uses in reset and pull)
  • [19] AOKPEHAJ Fixing the `pijul git` command with the new init
  • [20] 5SLOJYHG Fixing the Git feature
  • [21] EUZFFJSO Updating Pijul with the latest changes in Libpijul
  • [22] WTRH4B2X Formatting
  • [23] KWAMD2KR A few fixes in the documentation comments

Change contents

  • replacement in pijul/src/commands/git.rs at line 6
    [5.137305][5.728:772]()
    use std::collections::{BTreeMap, BTreeSet};
    [5.970]
    [5.137367]
    use std::collections::{BTreeMap, BTreeSet, HashSet};
  • edit in pijul/src/commands/git.rs at line 14
    [5.137477]
    [5.1590]
    /// Process this path instead of the current directory, creating a Pijul repository if necessary.
    pub git_path: Option<PathBuf>,
  • replacement in pijul/src/commands/git.rs at line 17
    [5.1692][5.1692:1728]()
    pub repo_path: Option<PathBuf>,
    [5.1692]
    [5.1728]
    pub pijul_path: Option<PathBuf>,
  • replacement in pijul/src/commands/git.rs at line 43
    [5.52][5.0:85](),[5.14293][5.0:85]()
    let repo = if let Ok(repo) = Repository::find_root(self.repo_path.clone()) {
    [5.52]
    [5.138182]
    let repo = if let Ok(repo) = Repository::find_root(self.pijul_path.clone()) {
  • edit in pijul/src/commands/git.rs at line 45
    [5.138199]
    [5.138199]
    } else {
    Repository::init(self.pijul_path.clone(), None, None)?
    };
    let git_path = if let Some(git_path) = self.git_path.clone() {
    git_path
  • replacement in pijul/src/commands/git.rs at line 51
    [5.138216][3.764:830]()
    Repository::init(self.repo_path.clone(), None, None)?
    [5.138216]
    [5.138270]
    repo.path.clone()
  • replacement in pijul/src/commands/git.rs at line 53
    [5.138281][5.138281:138336]()
    let git = git2::Repository::open(&repo.path)?;
    [5.138281]
    [2.0]
    let git = git2::Repository::open(&git_path)?;
  • replacement in pijul/src/commands/git.rs at line 489
    [5.152146][4.153:227]()
    ) -> Result<(git2::Object<'a>, BTreeMap<PathBuf, bool>), anyhow::Error> {
    [5.152146]
    [5.152214]
    ) -> Result<(git2::Object<'a>, BTreeMap<PathBuf, bool>, HashSet<String>), anyhow::Error> {
  • edit in pijul/src/commands/git.rs at line 499
    [4.268]
    [5.153473]
    let mut pref = HashSet::new();
  • replacement in pijul/src/commands/git.rs at line 558
    [5.156099][5.156099:156162](),[5.156162][4.348:407]()
    let new_path = new_path.to_path_buf();
    prefixes.insert(new_path, is_dir);
    [5.156099]
    [5.156213]
    let new_path_ = new_path.to_path_buf();
    pref.insert(new_path.to_str().unwrap().to_string());
    prefixes.insert(new_path_, is_dir);
  • replacement in pijul/src/commands/git.rs at line 569
    [5.156608][5.156608:156742](),[5.156742][4.468:594]()
    let old_path = old_path.to_path_buf();
    let new_path = new_path.to_path_buf();
    prefixes.insert(old_path, is_dir);
    prefixes.insert(new_path, is_dir);
    [5.156608]
    [5.156852]
    let old_path_ = old_path.to_path_buf();
    let new_path_ = new_path.to_path_buf();
    prefixes.insert(old_path_, is_dir);
    prefixes.insert(new_path_, is_dir);
    pref.insert(old_path.to_str().unwrap().to_string());
    pref.insert(new_path.to_str().unwrap().to_string());
  • replacement in pijul/src/commands/git.rs at line 603
    [5.157439][5.157439:157466]()
    Ok((object, prefixes))
    [5.157439]
    [4.682]
    Ok((object, prefixes, pref))
  • edit in pijul/src/commands/git.rs at line 610
    [4.776]
    [5.157466]
    pref: HashSet<String>,
  • replacement in pijul/src/commands/git.rs at line 644
    [4.1889][4.1889:2015]()
    fn modified_time(&self, _: &str) -> Result<std::time::SystemTime, Self::Error> {
    Ok(std::time::SystemTime::now())
    [4.1889]
    [4.2015]
    fn modified_time(&self, x: &str) -> Result<std::time::SystemTime, Self::Error> {
    if self.pref.contains(x) {
    Ok(std::time::SystemTime::now())
    } else {
    Ok(std::time::SystemTime::UNIX_EPOCH)
    }
  • replacement in pijul/src/commands/git.rs at line 663
    [5.3958][5.14694:14776]()
    let (object, prefixes) = git_reset(git, repo, &txn, &channel, child, stats)?;
    [5.3958]
    [5.319]
    let (object, prefixes, prefstr) = git_reset(git, repo, &txn, &channel, child, stats)?;
  • edit in pijul/src/commands/git.rs at line 731
    [4.3115]
    [4.3115]
    pref: prefstr,