diff --git a/Cargo.lock b/Cargo.lock index d30d1c2..6756c7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -290,7 +290,7 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "ppi" -version = "1.1.2" +version = "1.1.4" dependencies = [ "clap", "dirs", diff --git a/Cargo.toml b/Cargo.toml index 4c9812a..edd4a4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ppi" -version = "1.1.3" +version = "1.1.4" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 6c70e7b..a8470fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ struct Config{ subcommands: Subcommands } - +#[allow(dead_code)] #[derive(Debug)] enum Errors{IoErr(std::io::Error), GitErr(git2::Error), CliErr(CliError), Unknown} impl From for Errors { @@ -103,7 +103,6 @@ fn main() -> Result<(),Errors> { #[cfg(debug_assertions)] { eprintln!("repo cloned"); - std::io::stdin().read_line(&mut String::new())?; } eprintln!("checking out appropriate branch"); @@ -116,7 +115,6 @@ fn main() -> Result<(),Errors> { #[cfg(debug_assertions)] { eprintln!("origin deleted"); - std::io::stdin().read_line(&mut String::new())?; } let mut walk = repo.revwalk()?; @@ -128,16 +126,18 @@ fn main() -> Result<(),Errors> { #[cfg(debug_assertions)] { eprintln!("oldest commit found"); - std::io::stdin().read_line(&mut String::new())?; } let pwd = repo.path().parent().expect("very bad cloning into the root dir happening"); eprintln!("rebasing skeleton's commits down into single commit {:?}", pwd); // I give up git2 documentation/api is just too bad for me to do this with it - + let commit_arg:&str = &oldest_commit.id() + .as_bytes().iter() + .map(|byte|format!("{:02x}",byte)) + .collect::()[0..7]; handle_process(std::process::Command::new("git") .current_dir(pwd) - .args(["reset", "--mixed" , oldest_commit.id().as_bytes().iter().map(|byte|format!("{:x}",byte)).collect::().chars().take(7).collect::().as_str()]))?; + .args(["reset", "--mixed" , commit_arg]))?; handle_process(std::process::Command::new("git") .current_dir(pwd) @@ -163,6 +163,7 @@ fn main() -> Result<(),Errors> { prog_copy.print_help()?; Ok(()) } +#[allow(dead_code)] #[derive(Debug)] enum CliError{Io(std::io::Error), NonZero} impl From for CliError {