Skip to content

Commit

Permalink
Don't create commits if there was no change, save unnecessary history
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Mar 23, 2020
1 parent ce7da96 commit d7b9c61
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ report-only: $(RELEASE_EXECUTABLE) $(bare_index_path) ## Run the reporting stage
$(RELEASE_EXECUTABLE) mine -c $(bare_index_path) --cpu-o 10 -F 0 -P 0 -R 1 $(DB)
force-report-only: $(RELEASE_EXECUTABLE) $(bare_index_path) ## Run the reporting stage once, forcibly, rewriting everything and ignoring caches
$(RELEASE_EXECUTABLE) mine -c $(bare_index_path) --cpu-o 10 -F 0 -P 0 -R 1 -g '*' $(DB)
mine-nonstop: $(RELEASE_EXECUTABLE) $(bare_index_path) ## Run all operations continuously, fully automated
$(RELEASE_EXECUTABLE) mine -c $(bare_index_path) --io 10 --cpu 2 --cpu-o 10 $(DB)

##@ Waste Report Maintenance

Expand Down
9 changes: 9 additions & 0 deletions criner/src/engine/stage/report/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ pub fn select_callback(
repo.set_index(&mut index)?;
}

if let Ok(current_tree) =
repo.head().and_then(|h| h.peel_to_tree()).map(|t| t.id())
{
if current_tree == tree_oid {
progress.info("Skipping git commit as there was no change");
return Ok(());
}
}

{
progress.set(3);
progress.blocked("writing commit", None);
Expand Down
6 changes: 3 additions & 3 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ pub enum SubCommands {
time_limit: Option<humantime::Duration>,

/// The time between each fetch operation, specified in humantime, like 10s, 5min, or 2h, or '3h 2min 2s'
#[structopt(long, short = "f", default_value = "60s")]
#[structopt(long, short = "f", default_value = "5min")]
fetch_every: humantime::Duration,

/// If set, the amount of times the fetch stage will run. If set to 0, it will never run.
#[structopt(long, short = "F")]
fetch_at_most: Option<usize>,

/// The time between each processing run, specified in humantime, like 10s, 5min, or 2h, or '3h 2min 2s'
#[structopt(long, short = "p", default_value = "60s")]
#[structopt(long, short = "p", default_value = "5min")]
process_every: humantime::Duration,

/// If set, the amount of times the process stage will run. If set to 0, they will never run.
#[structopt(long, short = "P")]
process_at_most: Option<usize>,

/// The time between each reporting and processing run, specified in humantime, like 10s, 5min, or 2h, or '3h 2min 2s'
#[structopt(long, short = "r", default_value = "60s")]
#[structopt(long, short = "r", default_value = "5min")]
report_every: humantime::Duration,

/// If set, the amount of times the reporting stage will run. If set to 0, they will never run.
Expand Down

0 comments on commit d7b9c61

Please sign in to comment.