Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(git): use git fetching for fork mode (revived) #34467

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

janhoy
Copy link
Contributor

@janhoy janhoy commented Feb 25, 2025

This fixes #13586.

Changes

Apply code from 3-year old PR #13808 to current main branch.

Context

We need to use renovate in forking mode on two different branches. So I was recommended in #7850 (comment) to revive an old PR to get a starting point.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@CLAassistant
Copy link

CLAassistant commented Feb 25, 2025

CLA assistant check
All committers have signed the CLA.

@janhoy
Copy link
Contributor Author

janhoy commented Feb 25, 2025

@rarkins Please review and see if the intent of your original PR is preserved here. There could of course be other places in the code base that need touching due to codebase changes. There may be a need for additional tests. Please guide/advice.

config.branchCommits = {};
const opts = ['ls-remote', '--heads', config.url];
const url =
preferUpstream && config.upstreamUrl ? config.upstreamUrl : config.url;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Coverage test fails on this line. Need to trigger syncGit() with preferUpstream==false in some test..

Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

Naturally this will need some good testing on a real repo too

(await getDefaultBranch(git));
delete getCache()?.semanticCommits;
config.currentBranch = config.currentBranch || (await getDefaultBranch(git));
// istanbul ignore if
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// istanbul ignore if

Let's aim to test it this time

@janhoy janhoy marked this pull request as draft March 5, 2025 21:46
@janhoy
Copy link
Contributor Author

janhoy commented Mar 5, 2025

Marking this as a draft.

I'm tempted to focus the energy on #34532 which is currently being updated after reviews, and which builds on this PR and extends/refactors it, and enables baseBranches for forks.

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.

Refactor forkMode to use git fetching
3 participants