summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorStephen Jung <tummychow511@gmail.com>2024-02-22 22:29:12 -0500
committerGitHub <noreply@github.com>2024-02-22 22:29:12 -0500
commit172ee0f1525c8a23e0e80854928917b44856e795 (patch)
treed4da2637a718adda8c14693035f4f59526b80a28 /src/lib.rs
parent656261484570534ac4ce8d373bfea8c32b8910d1 (diff)
parentd6128a307a56955d7013597b5a2c98fd836aff1d (diff)
Merge pull request #101 from kiprasmel/config-one-commit-per-fixup
introduce git config option `absorb.oneFixupPerCommit`
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index fe9e3e6..6898f91 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,7 @@ extern crate slog;
use anyhow::{anyhow, Result};
mod commute;
+mod config;
mod owned;
mod stack;
@@ -18,9 +19,22 @@ pub struct Config<'a> {
pub logger: &'a slog::Logger,
}
-pub fn run(config: &Config) -> Result<()> {
+pub fn run(config: &mut Config) -> Result<()> {
let repo = git2::Repository::open_from_env()?;
debug!(config.logger, "repository found"; "path" => repo.path().to_str());
+
+ // here, we default to the git config value,
+ // if the flag was not provided in the CLI.
+ //
+ // in the future, we'd likely want to differentiate between
+ // a "non-provided" option, vs an explicit --no-<option>
+ // that disables a behavior, much like git does.
+ // e.g. user may want to overwrite a config value with
+ // --no-one-fixup-per-commit -- then, defaulting to the config value
+ // like we do here is no longer sufficient. but until then, this is fine.
+ //
+ config.one_fixup_per_commit |= config::one_fixup_per_commit(&repo);
+
run_with_repo(config, &repo)
}