fix: fixed commit with editor regression
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 <christina@cafkafk.com>
This commit is contained in:
parent
25fe576052
commit
6595bd5148
3 changed files with 13 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gg"
|
name = "gg"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Christina Sørensen <christina@cafkafk.com>"]
|
authors = ["Christina Sørensen <christina@cafkafk.com>"]
|
||||||
repository = "https://github.com/cafkafk/gg"
|
repository = "https://github.com/cafkafk/gg"
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
- [ ] Generic repositories
|
- [ ] Generic repositories
|
||||||
- [ ] Version pinning
|
- [ ] Version pinning
|
||||||
- [ ] libgit2 (maybe)
|
- [ ] libgit2 (maybe)
|
||||||
* 0.1.0 [0%] [0/5]
|
* 0.1.0 [20%] [1/5]
|
||||||
- [-] No functionality regressions
|
- [X] No functionality regressions
|
||||||
- [X] commit works in quick, fast
|
- [X] commit works in quick, fast
|
||||||
- [-] commit with edit works
|
- [X] commit with edit works
|
||||||
- [ ] Repo Flags Finished
|
- [ ] Repo Flags Finished
|
||||||
- [ ] Category Flags Finished
|
- [ ] Category Flags Finished
|
||||||
- [ ] Optional Fields
|
- [ ] Optional Fields
|
||||||
|
|
16
src/git.rs
16
src/git.rs
|
@ -189,20 +189,22 @@ impl GitRepo {
|
||||||
}
|
}
|
||||||
/// Tries to commit changes in the repository.
|
/// Tries to commit changes in the repository.
|
||||||
///
|
///
|
||||||
/// BUG does not work with output should use status() instead so it opens
|
/// # Development
|
||||||
/// the editor
|
///
|
||||||
|
/// - 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)]
|
#[allow(dead_code)]
|
||||||
fn commit(&self) -> bool {
|
fn commit(&self) -> bool {
|
||||||
if self.flags.contains(&RepoFlags::Push) {
|
if self.flags.contains(&RepoFlags::Push) {
|
||||||
let output = Command::new("git")
|
let status = Command::new("git")
|
||||||
.current_dir(format!("{}{}", &self.path, &self.name))
|
.current_dir(format!("{}{}", &self.path, &self.name))
|
||||||
.arg("commit")
|
.arg("commit")
|
||||||
.output()
|
.status()
|
||||||
.unwrap_or_else(|_| panic!("git repo failed to commit: {:?}", &self,));
|
.unwrap_or_else(|_| panic!("git repo failed to commit: {:?}", &self,));
|
||||||
println!("{output:?}");
|
status.success()
|
||||||
output.status.success()
|
|
||||||
} else {
|
} else {
|
||||||
info!("{} has clone set to false, not cloned", &self.name);
|
info!("{} has push set to false, not cloned", &self.name);
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue