jenkinsci / jenkinsci/git-plugin

[JENKINS-48942] Checkout with PreMerge leads to "Reference is not a tree" error

Open
#3,253 0 comments 0 reactions 0 assignees View on GitHub
component:git-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
694
Forks
1.1k
Avg merge
1h 29m
Merged PRs (30d)
3

Description

We are using Bitbucket and pull-request-notifier-for-Bitbucket to notify jenkins of pull request.

Jenkins uses the git-plugin to do a premerge of the specific branch into master.

If a new pr is opened the premerge and build works fine. But if the build failes and pull request is triggered a second time the error "reference is not a tree" occurs. 

After debugging the git plugin for some time I found out that the Build.xml is saves already build branches/revisions and therefore skips the merge part, which leads to the error.

data represents the BuildData from the previous build.xml. 

After creating a new project and creating a pull request, I've noticed that the error does not occur. After debugging both projects I've come to the conclusion, that the build.xml is identical but the new project only extracts the first occurance of BuildData, while the failing project uses all occurances. 

Failing project: all returns all occurances of BuildData

Successful project: return first occurance of BuildData

 Why is build.getActions returning different results?

The current Workaround includes modifing the git plugin in a way that it does not remove already build revisions.

---
Originally reported by kerschy, imported from: Checkout with PreMerge leads to "Reference is not a tree" error


  • status: Open
  • priority: Major
  • component(s): git-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-02

Raw content of original issue

We are using Bitbucket and pull-request-notifier-for-Bitbucket to notify jenkins of pull request.
Jenkins uses the git-plugin to do a premerge of the specific branch into master.

If a new pr is opened the premerge and build works fine. But if the build failes and pull request is triggered a second time the error "reference is not a tree" occurs. 

After debugging the git plugin for some time I found out that the Build.xml is saves already build branches/revisions and therefore skips the merge part, which leads to the error.

data represents the BuildData from the previous build.xml. 

After creating a new project and creating a pull request, I've noticed that the error does not occur. After debugging both projects I've come to the conclusion, that the build.xml is identical but the new project only extracts the first occurance of BuildData, while the failing project uses all occurances. 

Failing project: all returns all occurances of BuildData

Successful project: return first occurance of BuildData

 Why is build.getActions returning different results?

The current Workaround includes modifing the git plugin in a way that it does not remove already build revisions.

  • environment: 2.89.2

5 attachments

- [image-2018-01-15-13-19-04-018.png](https://issues.jenkins.io/secure/attachment/41121/image-2018-01-15-13-19-04-018.png)
> ![image-2018-01-15-13-19-04-018.png](https://issues.jenkins.io/secure/attachment/41121/image-2018-01-15-13-19-04-018.png)
- [image-2018-01-15-13-22-12-164.png](https://issues.jenkins.io/secure/attachment/41120/image-2018-01-15-13-22-12-164.png)
> ![image-2018-01-15-13-22-12-164.png](https://issues.jenkins.io/secure/attachment/41120/image-2018-01-15-13-22-12-164.png)
- [image-2018-01-15-13-30-25-807.png](https://issues.jenkins.io/secure/attachment/41118/image-2018-01-15-13-30-25-807.png)
> ![image-2018-01-15-13-30-25-807.png](https://issues.jenkins.io/secure/attachment/41118/image-2018-01-15-13-30-25-807.png)
- [image-2018-01-15-13-31-17-323.png](https://issues.jenkins.io/secure/attachment/41116/image-2018-01-15-13-31-17-323.png)
> ![image-2018-01-15-13-31-17-323.png](https://issues.jenkins.io/secure/attachment/41116/image-2018-01-15-13-31-17-323.png)
- [image-2018-01-15-13-32-53-489.png](https://issues.jenkins.io/secure/attachment/41115/image-2018-01-15-13-32-53-489.png)
> ![image-2018-01-15-13-32-53-489.png](https://issues.jenkins.io/secure/attachment/41115/image-2018-01-15-13-32-53-489.png)

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.