Skip to content

Add repository caching and enqueue clone on startup#721

Open
reddevilmidzy wants to merge 3 commits intorust-lang:mainfrom
reddevilmidzy:local
Open

Add repository caching and enqueue clone on startup#721
reddevilmidzy wants to merge 3 commits intorust-lang:mainfrom
reddevilmidzy:local

Conversation

@reddevilmidzy
Copy link
Copy Markdown
Member

@reddevilmidzy reddevilmidzy commented Mar 26, 2026

close: #693

Add gitops cache with CloneRepository. and reuse cached bare repos for squash commit transfer.

Copy link
Copy Markdown
Member Author

@reddevilmidzy reddevilmidzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we forgot to discuss testing—would now be a good time to start using a git mock for this?

View changes since this review

Comment on lines +25 to +26
/// Special pull request number used for clone operations.
const CLONE_PR_NUMBER: PullRequestNumber = PullRequestNumber(0);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use CLONE_PR_NUMBER = 0 as a synthetic PR ID for clone tasks. Is this OK?

Comment on lines +185 to +197
#[cfg(test)]
let cache_dir = tempfile::Builder::new()
.prefix("bors-gitops-cache-")
.tempdir()
.expect("Cannot create gitops cache temp dir");
#[cfg(not(test))]
let cache_dir = {
let base_dir = std::env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
tempfile::Builder::new()
.prefix("gitops-cache-")
.tempdir_in(&base_dir)
.expect("Cannot create gitops cache temp dir")
};
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I create the cache TempDir internally. Would it be more reasonable to pass the cache directory in as a parameter instead?

@reddevilmidzy reddevilmidzy marked this pull request as ready for review March 26, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement local git operations for squashing

1 participant