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

Remove check for git user.name and user.email to be set? #455

Open
traversaro opened this issue Aug 10, 2024 · 0 comments
Open

Remove check for git user.name and user.email to be set? #455

traversaro opened this issue Aug 10, 2024 · 0 comments

Comments

@traversaro
Copy link
Member

In YCMEPHelper in

execute_process(COMMAND ${GIT_EXECUTABLE} config --get user.name
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE _error_code
OUTPUT_VARIABLE _output_name
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT NON_INTERACTIVE_BUILD AND _error_code)
message(FATAL_ERROR "Failed to get git name. Please set it with \"git config --global user.name Firstname Lastname\" or from your favorite git gui.")
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} config --get user.email
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE _error_code
OUTPUT_VARIABLE _output_email
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT NON_INTERACTIVE_BUILD AND _error_code)
message(FATAL_ERROR "Failed to get git email. Please set it with \"git config --global user.email [email protected]\" or from your favorite git gui.")
endif()
(and hence in any ycm-based superbuild that uses git, so basically all of them) there is some code that checks if the git user.name and user.email is set, and if they are not set, raise a fatal error.

This hit (at least me) many times when trying to run the superbuild on vanilla (Docker, GitHub Actions, gitpod, etc etc) machine, and I am afraid that many other users have been affected as well.

As far as I can understand, the only reason why such check is there is to prevent users to actually commit commits with the automatically generated values for user.name and user.email, i.e. creating warnings such as:

Your name and e-mail address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

however, it does not seems to be that have an hard failure whenever somebody is trying to run the superbuild in a clean environment is worth avoiding in some remote case some autogenerated commit metadata.

So, my plan is to remove this check in the next 0.17.0 release of YCM. The idea is to remove the check rather then just do some sort of tick-tock deprecation cycle, as far as I understand, nothing can break if we remove this check.

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

No branches or pull requests

1 participant