Skip to content

Commit

Permalink
clone: fix duplicate --shallow-since argument
Browse files Browse the repository at this point in the history
We were both manually passing a `--shallow-since` value via`add_clone_arg` and using the default value. This wasn't causing any harm, but it's confusing.
  • Loading branch information
arxanas committed Aug 29, 2022
1 parent 4a916df commit 578a827
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions focus/operations/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use focus_internals::index::RocksDBMemoizationCacheExt;
use focus_internals::model::selection::{Operation, OperationAction};

use anyhow::{bail, Context, Result};
use chrono::{DateTime, Datelike, Duration, Local, NaiveDate, NaiveDateTime, Utc};
use chrono::{DateTime, NaiveDate, NaiveDateTime, Utc};
use content_addressed_cache::RocksDBCache;
use focus_internals::{model::repo::Repo, target::TargetSet, tracker::Tracker};

Expand Down Expand Up @@ -66,18 +66,6 @@ pub struct CloneBuilder {
}

const DEFAULT_SINGLE_BRANCH: &str = "master";
const MASTER_HISTORY_WINDOW_DAYS: i64 = 90;

fn default_master_history_window() -> Duration {
Duration::days(MASTER_HISTORY_WINDOW_DAYS)
}

fn default_shallow_since() -> NaiveDate {
let t = Local::now();
let nd = NaiveDate::from_ymd(t.year(), t.month(), t.day());

nd - default_master_history_window()
}

pub fn parse_shallow_since_date(s: &str) -> Result<NaiveDate> {
Ok(NaiveDate::parse_from_str(s, "%Y-%m-%d")?)
Expand All @@ -89,7 +77,7 @@ impl Default for CloneBuilder {
target_path: PathBuf::new(),
fetch_url: None,
push_url: None,
shallow_since: Some(default_shallow_since()),
shallow_since: None,
branch_name: String::from(DEFAULT_SINGLE_BRANCH),
filter: None,
repo_config: Vec::new(),
Expand Down

0 comments on commit 578a827

Please sign in to comment.