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

x-update-baseline does not respect reference (git branch) #38701

Closed
tobylane opened this issue May 12, 2024 · 3 comments · Fixed by #39836
Closed

x-update-baseline does not respect reference (git branch) #38701

tobylane opened this issue May 12, 2024 · 3 comments · Fixed by #39836
Assignees
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof

Comments

@tobylane
Copy link

tobylane commented May 12, 2024

Describe the bug
Updating the baseline in vcpkg-configuration.json ignores the reference. If another commit in the repository is newer. even in another branch (or only main?) it is used.

Environment
Not OS specific

To Reproduce
Steps to reproduce the behavior:

  1. Download https://github.com/tobylane/CorsixTH/blob/06316899e5daf04ff0fd344443d0b64d50723fbc/vcpkg-configuration.json
  2. vcpkg x-update-baseline --dry-run
  3. See the line "updated registry 'https://github.com/TheCycoONE/vcpkg-registry': baseline '15529ddf98c6ae963861c7fdc145c969d666aadf' -> '7e2920647c0c00b21d684c887d2c9b375a1b5b32'"

Expected behavior
It should respect the reference. The commit starting 15529dd is the head of that branch and does not need changing.

Additional context
The alternative I have is below, but I think x-updatebaseline` should do this by default, as it's the least surprising option. Switching to another reference (ie changing branch to main) should be behind an option.

          newsha="$(curl -s https://api.github.com/repos/microsoft/vcpkg/git/refs/heads/master | jq '.object.sha')"
          jq '."default-registry".baseline = '$newsha vcpkg-configuration.json > tmp
          mv tmp vcpkg-configuration.json

edit: I don't know this program or cpp, but should HEAD be here? https://github.com/microsoft/vcpkg-tool/blob/main/src/vcpkg/configuration.cpp#L695

@LilyWangLL LilyWangLL added the category:question This issue is a question label May 13, 2024
@LilyWangLL
Copy link
Contributor

Thanks for posting this issue. I use command git rev-parse HEAD to get the latest commit ID of the repo https://github.com/TheCycoONE/vcpkg-registry/tree/lua_cmake, the latest commit ID is 7e2920647c0c00b21d684c887d2c9b375a1b5b32.
image

@tobylane
Copy link
Author

From docs for reference

The Git reference used to list available versions of a Git Registry. A string. Optional. If not specified, defaults to HEAD. This field can be a topic branch to access versions that are not yet fully published.

It sounds like reference is used here to identify an alternative version, in another branch. The git rev-parse command needs the reference if it exists, or HEAD.

@LilyWangLL
Copy link
Contributor

I switched to branch lua_cmake, then used command git rev-parse HEAD to get the latest commit of that branch, the value is 15529ddf98c6ae963861c7fdc145c969d666aadf. I checked the code on the vcpkg-tool, and it seems that the case where the keyword reference is a branch is not handled. I have temporarily marked this issue as Vcpkg bug.

cc on call manger @data-queue and @BillyONeal, could you please take a look this issue?

@LilyWangLL LilyWangLL added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) and removed category:question This issue is a question labels May 17, 2024
@BillyONeal BillyONeal added the requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants