From 6595bd51488bb29e3ce80c5414c29e57c58068d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Sun, 2 Jul 2023 10:20:42 +0200 Subject: [PATCH] fix: fixed commit with editor regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows committing with the users set editor, which is very handy if you don't want to actually make meaningful commits. This existed before, but implementing the instruction architecture for composite actions broke it, because the status code refactor used output() instead of status(). Thankfully, this does support exit codes still, but it does create some cluttered output which is not terrible great UX, but this is not extremely important, as this associated function isn't even currently used by any user facing commands (except its explicit subcommand). :D Signed-off-by: Christina Sørensen --- Cargo.toml | 2 +- doc/roadmap.org | 6 +++--- src/git.rs | 16 +++++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c23ced2..4536876 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gg" -version = "0.0.5" +version = "0.0.6" edition = "2021" authors = ["Christina Sørensen "] repository = "https://github.com/cafkafk/gg" diff --git a/doc/roadmap.org b/doc/roadmap.org index 5f9a02c..8b6665a 100644 --- a/doc/roadmap.org +++ b/doc/roadmap.org @@ -5,10 +5,10 @@ - [ ] Generic repositories - [ ] Version pinning - [ ] libgit2 (maybe) -* 0.1.0 [0%] [0/5] -- [-] No functionality regressions +* 0.1.0 [20%] [1/5] +- [X] No functionality regressions - [X] commit works in quick, fast - - [-] commit with edit works + - [X] commit with edit works - [ ] Repo Flags Finished - [ ] Category Flags Finished - [ ] Optional Fields diff --git a/src/git.rs b/src/git.rs index ad5e15a..4bb0e65 100644 --- a/src/git.rs +++ b/src/git.rs @@ -189,20 +189,22 @@ impl GitRepo { } /// Tries to commit changes in the repository. /// - /// BUG does not work with output should use status() instead so it opens - /// the editor + /// # Development + /// + /// - FIXME: this prints extra information to terminal this is because we + /// use status() instead of output(), as that makes using the native editor + /// easy #[allow(dead_code)] fn commit(&self) -> bool { if self.flags.contains(&RepoFlags::Push) { - let output = Command::new("git") + let status = Command::new("git") .current_dir(format!("{}{}", &self.path, &self.name)) .arg("commit") - .output() + .status() .unwrap_or_else(|_| panic!("git repo failed to commit: {:?}", &self,)); - println!("{output:?}"); - output.status.success() + status.success() } else { - info!("{} has clone set to false, not cloned", &self.name); + info!("{} has push set to false, not cloned", &self.name); false } }