Skip to content

Set Git configuration to default during tests ~~Disable GPG signing tags during tests~~#13727

Merged
Alizter merged 1 commit intoocaml:mainfrom
Durbatuluk1701:test_tag_fix
Mar 4, 2026
Merged

Set Git configuration to default during tests ~~Disable GPG signing tags during tests~~#13727
Alizter merged 1 commit intoocaml:mainfrom
Durbatuluk1701:test_tag_fix

Conversation

@Durbatuluk1701
Copy link
Contributor

When running the tests on a clean main branch, I ran into some issues related to lightweight git tag commands. In particular, because I have tag.gpgSign set globally, it always expects a message and breaks the tests.

For example:


Would try to open my git.config.core.editor and break the rest of the test:

+|  Vim: Warning: Output is not to a terminal
+|  Vim: Warning: Input is not from a terminal
<pkg/mock-opam-repository/.git/TAG_EDITMSG" 5L, 81B  1                                                                               2 #
+|    3 # Write a message for tag:
+|    4 #   1.0
+|    5 # Lines starting with '#' will be ignored.
+|  ~                                                                               Vim: Error reading input, exiting...
+|  Vim: Finished.
+|   with the editor 'vim'.
+|  Please supply the message using either -m or -F option.
+|  [1]

Not sure if this is a problem that I should just be solving locally, but the change is relatively minimal so I thought I'd open this and at least it can be documented for those who might encounter it in the future.

@Alizter
Copy link
Collaborator

Alizter commented Mar 4, 2026

I think your fix is fine, but perhaps a better fix would be to disable the global config in git locally. We want the tests to act the same irregardless of a users global configuration. Something like:

export GIT_CONFIG_GLOBAL=""

might be enough.

@Alizter Alizter added package management test Dune handling test labels Mar 4, 2026
@Leonidas-from-XIV
Copy link
Collaborator

Thanks for the report @Durbatuluk1701.

I agree with @Alizter's assessment; we should probably make sure that the git used in the tests acts in general as default as possible because there might be other things that the user might have configured that break the tests.

… setup

Signed-off-by: Will Thomas <30wthomas@gmail.com>
@Durbatuluk1701
Copy link
Contributor Author

Thank you for the feedback, definitely a much better approach.

I did some extra research and it revealed the GIT_CONFIG_SYSTEM variable that I made a fix for as well (I confirmed it could cause local issues as well). Further, it appears the idiomatic suggestion is /dev/null and it will be translated by mingw to NUL for windows.

@Durbatuluk1701 Durbatuluk1701 changed the title Disable GPG signing tags during tests Set Git configuration to default during tests ~~Disable GPG signing tags during tests~~ Mar 4, 2026
@Alizter
Copy link
Collaborator

Alizter commented Mar 4, 2026

FTR we don't currently run the test on Windows (mingw) but this may change in the future. It is of course the job of the maintainers in the future to consider such changes.

Thank you for the patch!

@Alizter
Copy link
Collaborator

Alizter commented Mar 4, 2026

@Durbatuluk1701 Just to quickly check, does this resolve the issue you were having with the test on your end, we won't be able to see it in the CI.

@Alizter Alizter self-requested a review March 4, 2026 16:50
@Durbatuluk1701
Copy link
Contributor Author

@Durbatuluk1701 Just to quickly check, does this resolve the issue you were having with the test on your end, we won't be able to see it in the CI.

Yes it does, thank you!

@Alizter Alizter merged commit cae07ff into ocaml:main Mar 4, 2026
29 checks passed
@Durbatuluk1701 Durbatuluk1701 deleted the test_tag_fix branch March 4, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package management test Dune handling test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants