Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ambv
Copy link
Contributor

@ambv ambv commented Dec 6, 2025

With yesterday's update to the Fedora rawhide Docker image, the new gcc 15.2 started reporting some discarded qualifier warnings, that we treat as errors:

/home/libgit2/source/src/libgit2/attr_file.c: In function 'git_attr_fnmatch__parse':
/home/libgit2/source/src/libgit2/attr_file.c:814:31: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  814 |                 char *slash = strrchr(context, '/');
      |                               ^~~~~~~
At top level:
cc1: all warnings being treated as errors

This PR fixes all of them so the build passes in Docker.

cl_git_pass(git_str_join_n(&logpath, '/', 3, git_repository_path(g_repo), GIT_REFLOG_DIR, refname));
cl_git_pass(git_futils_readbuffer(&logcontents, git_str_cstr(&logpath)));
cl_assert((star = strchr(git_str_cstr(&logcontents), '*')) != NULL);
cl_assert((star = strchr(logcontents.ptr, '*')) != NULL);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the other cases are trivial, this one's a bit different. It's because we are indeed writing through star in the next line to modify the buffer, so I just used .ptr directly.

@ethomson ethomson merged commit cd3ebc9 into libgit2:main Dec 20, 2025
19 checks passed
@ethomson
Copy link
Member

Thanks for the fix!

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.

2 participants