Skip to content

git: checkout.validate should set to branch only if both branch and hash are empty #1525

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

GaikwadPratik
Copy link

add validation usecase for Force and keep.

This would avoid the error condition where if Hash is provided on CheckoutOptions but NOT branch and validate is called since per documentation:

// Branch to be checked out, if Branch and Hash are empty is set to master.
Branch plumbing.ReferenceName

…ash are empty

add validation usecase for Force and keep
pjbgf
pjbgf previously approved these changes Apr 26, 2025
Copy link
Member

@pjbgf pjbgf left a comment

Choose a reason for hiding this comment

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

@GaikwadPratik thanks for working on this. 🙇

@pjbgf pjbgf dismissed their stale review April 26, 2025 15:01

failing tests

@pjbgf
Copy link
Member

pjbgf commented Apr 26, 2025

@GaikwadPratik can you please take a look at the failing tests?

@GaikwadPratik
Copy link
Author

GaikwadPratik commented Apr 26, 2025

Hi @pjbgf , applied the suggestions, can you please trigger another pipeline? Is there a way to run make test-coverage locally? If I run that locally, even on main branch, I get a lot different errors.

@pjbgf
Copy link
Member

pjbgf commented Apr 27, 2025

@GaikwadPratik I generally run make test or rely on go test for specific tests I'm trying to run. Please note that some tests require git-daemon installed, without it you will get some errors.

@GaikwadPratik
Copy link
Author

@GaikwadPratik I generally run make test or rely on go test for specific tests I'm trying to run. Please note that some tests require git-daemon installed, without it you will get some errors.

Can we please update the documentation?

Also any idea why pipeline is failing even though my code doesn't touch those tests?

Copy link
Contributor

@onee-only onee-only left a comment

Choose a reason for hiding this comment

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

FYI, this fails on my codespace too.

@GaikwadPratik
Copy link
Author

@pjbgf , okay my changes were breaking one of the test in worktree_test. Fixed the code conditions and tests for CheckoutOptions as well by keeping them simple and to the basics. Ran make test locally and they ran successfully.

image

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.

3 participants