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

Git diff request correctly throws NotFoundException if target revision is non-existent #2141

Merged
merged 3 commits into from Oct 24, 2022

Conversation

Pilopa
Copy link
Contributor

@Pilopa Pilopa commented Oct 24, 2022

Proposed changes

Sometimes it happens that a git diff command request is performed with a non-existent target branch. This is usually fine but the underlying system might have already garbage-collected the revisions associated with that branch. In this case, the revision for that deleted branch might turn up null which currently causes a 500 error. We catch this specific corner-case and throw the correct NotFoundException instead.

Your checklist for this pull request

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Contributor:

  • PR is well described and the description can be used as a commit message on squash
  • Related issues linked to PR if existing and labels set
  • Changelog entry file created in gradle/changelog

Reviewer:

  • The clean code principles are respected (CleanCode)
  • All new code/logic is implemented on the right spot / "Should this be done here?"
  • UI changes fits into the layout
  • The UI views / components are responsive (mobile views)
  • Correct translations are available

Checklist for branch merge request (not required for forks)

@sonarcloud
Copy link

sonarcloud bot commented Oct 24, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@pfeuffer pfeuffer merged commit 96ce4cb into develop Oct 24, 2022
@delete-merged-branch delete-merged-branch bot deleted the bugfix/deleted-target-branch-diff branch October 24, 2022 17:49
fscholdei pushed a commit to scm-manager/scm-review-plugin that referenced this pull request Oct 26, 2022
Currently, when either the source or the target branch of a pull request is deleted, the PR is rejected with either a generic "branch deleted" cause or, even worse, with a "source branch deleted" comment. This has no been fixed to correctly differentiate between target and/or source branch deletion. Uses a core fix from scm-manager/scm-manager#2141 in the newly introduced e2e tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants