From f2fbd47cf8427358227c349265e4d1fd9344f03a Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Fri, 29 Dec 2023 14:26:28 -0600 Subject: [PATCH] testing: configure repos cloned with `Git::clone_repo_into` I noticed that relative timestamps were enabled in the cloned repo's smartlog. That kind of output is non-deterministic, so it can't go into snapshot tests. To fix this, invoke the same configuration that we do to initialize repositories normally. --- git-branchless-lib/src/testing.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/git-branchless-lib/src/testing.rs b/git-branchless-lib/src/testing.rs index 6c1642ad2..6799bc5f8 100644 --- a/git-branchless-lib/src/testing.rs +++ b/git-branchless-lib/src/testing.rs @@ -467,6 +467,18 @@ then you can only run tests in the main `git-branchless` and \ }; let (_stdout, _stderr) = self.run(args.as_slice())?; + + // Configuration options are not inherited from the original repo, so + // set them in the cloned repo. + let new_repo = Git { + repo_path: target.repo_path.clone(), + ..self.clone() + }; + new_repo.init_repo_with_options(&GitInitOptions { + make_initial_commit: false, + run_branchless_init: false, + })?; + Ok(()) }