jenkinsci / jenkinsci/workflow-multibranch-plugin

[JENKINS-70200] Get only the git history from pull request's base

Open
#541 2 comments 0 reactions 0 assignees View on GitHub
component:workflow-multibranch-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
87
Forks
131
PR merge metrics
No merged PRs in 30d

Description

Currently, when building PRs in a multi-branch pipeline job, one has two choices:



  • clone the repository with the whole history of the PR's branch (default)

  • clone the repository with a fixed amount of commits using the `cloneOptionTrait`

A third option that would retrieve only the commits from the PR that are on top of the PR base would be awesome.

Basically, I want to inspect the git history of my PR to implement checks on the git diff and currently, I either fetch the whole repository (in GitOps repositories it's heavyweight) or settle for an arbitrary depth and pray that no PR becomes too big.

Even getting the number of commits in the PR (in the environment for example) would do, I can just call `git fetch --deepen=$PR_COMMITS_NUMBER` which would be enough.

---
Originally reported by quilicicf, imported from: Get only the git history from pull request's base


  • status: Open
  • priority: Minor
  • component(s): workflow-multibranch-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 20251212-090250

Raw content of original issue

Currently, when building PRs in a multi-branch pipeline job, one has two choices:



  • clone the repository with the whole history of the PR's branch (default)

  • clone the repository with a fixed amount of commits using the `cloneOptionTrait`

A third option that would retrieve only the commits from the PR that are on top of the PR base would be awesome.

Basically, I want to inspect the git history of my PR to implement checks on the git diff and currently, I either fetch the whole repository (in GitOps repositories it's heavyweight) or settle for an arbitrary depth and pray that no PR becomes too big.

Even getting the number of commits in the PR (in the environment for example) would do, I can just call `git fetch --deepen=$PR_COMMITS_NUMBER` which would be enough.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.