pijul_org / pijul

Enable add-free workflow: allow to add files to ".pijul/local/ignore" from record's interface, and make record -n not pollute pending with the adds that the user did not record

By FlorentBecker on April 8, 2018
This patch is not signed.
6vLTf4KBGKUpuHA2X5DW3dZ5vyMu36CH5pH1kTeTod5R1y8ttmXMx9UT8MPdgXdXK9bptzgb4daPENUnXuwoCMtE
This patch is in the following branches:
latest
master
testing
In file pijul/src/commands

























































            Ok(i) => {
                match i.build() {
                    Ok(i) => i.matched_path_or_any_parents(&file, false).is_ignore(),
                    Err(e) => {
                        println!("could not match pattern {}: {}", &pat, e);
                        false
                    }
            }

            ChangesDirection::Record => {
                match changes[i] {
                    Record::FileAdd { ref name, .. } => Some(&name),
                    _ => None,
                }
            }
                    Record::FileAdd { ref name, .. } =>
                    {
                        let name : PathBuf = name.into();
                    },
            'I' => {
                match potential_new_ignore {
                    Some(file) => {
                        add_to_ignore_file(
                            file,
                            repo_root,
                            &mut new_ignored_patterns,
                            &mut new_ignore_builder,
                        );
                        choices.insert(i, !direction.is_record());
                        i += 1;
                    }
                    _ => {}
            }

pub fn read_line_with_suggestion(prompt: &str, suggestion: &str) -> String {
    #[cfg(unix)]
    let mut con = Context::new();
    if let Ok(res) = con.read_line_with_init_buffer(prompt, &mut |_| {}, suggestion) {
        res.into()
    } else {
        let stdin = std::io::stdin();
        let mut stdin = stdin.lock().lines();
        if let Some(Ok(x)) = stdin.next() {
            x
        } else {
            String::new()
        }
    }

    #[cfg(windows)]
    {
        let mut rl = rustyline::Editor::<()>::new();
        let input = rl.readline(prompt)?;
        Ok(vec![input])
    }
) -> Result<(Vec<Record<Vec<Key<Option<Hash>>>>>, Vec<InodeUpdate>)> {
        append_to_ignore_file(&opts.repo_root, &i);
In file pijul/src