-
Notifications
You must be signed in to change notification settings - Fork 2.1k
CommitStats
in the Commit
struct is always nil
#3394
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
Comments
I'm not sure I would call this issue a "bug". According to GitHub, that line was added in 2013 in this commit: So apparently it was once used by GitHub. As to its current usage, that would definitely require some investigation. |
CommitStats
in the Commit
struct is always nilCommitStats
in the Commit
struct is always nil
Thanks for the quick answer @gmlewis. I will investigate as it wrongly put me into assuming I could check a created commit stats from the response. I do think that it is not populated at all in any case. If that's the case I can submit a PR removing that field, otherwise a PR explaining where it is used. |
Excellent. Thanks, @acouvreur . Sounds good. It's yours. |
Usage in struct `CheckSuite`: ✅ No usageThe Lines 71 to 92 in c4a49db
As mentionned, the This is the same for Usage in struct `MergeGroup`: ✅ No usageThe go-github/github/event_types.go Lines 842 to 854 in c4a49db
The This is the same for Usage in struct `Commit`: ✅ No usageThe go-github/github/git_commits.go Lines 44 to 62 in c4a49db
This could be refined to be a Conclusion: no usage of Usage in struct `Timeline`: ✅ No usageThe go-github/github/issues_timeline.go Lines 18 to 38 in c4a49db
This is only used in a single Timeline event, which is
This could be refined to be a Conclusion: no usage of Usage in struct `RepositoryTag`: ✅ No usageThe This is only used in listing the tags in a repository: https://docs.github.com/en/rest/repos/repos#list-repository-tags
This could be refined to be a Conclusion: no usage of Usage in struct `BranchCommit`: ✅ No usageThe This is only used in listing branches for HEAD commit: https://docs.github.com/en/rest/commits/commits#list-branches-for-head-commit
This could be refined to be a Conclusion: no usage of Usage in struct `RepositoryCommit`: ✅ No usageThe go-github/github/repos_commits.go Lines 16 to 34 in c4a49db
Usage in struct `StatusEvent`: ✅ No usageThe `StatusEvent` struct is not used directly by any function or struct.And the event schema is defined as: Usage in function `RepositoriesService.ListBranches`: ✅ No usageThe `RepositoriesService.ListBranches` function returns a `Branch` which contains a `RepositoryCommit`.The OpenAPI Schema defines the following: This could be refined to be a Conclusion: no usage of Usage in function `RepositoriesService.GetBranch`: ✅ No usageThe `RepositoriesService.GetBranch` function returns a `Branch` which contains a `RepositoryCommit`.The OpenAPI Schema defines the following: Conclusion: no usage of Usage in function `RepositoriesService.RenameBranch`: ✅ No usageThe `RepositoriesService.RenameBranch` function returns a `Branch` which contains a `RepositoryCommit`.The OpenAPI Schema defines the following: Conclusion: no usage of Usage in function `RepositoriesService.CompareCommits`: ✅ No usageThe The OpenAPI Schema defines the following: Conclusion: no usage of Usage in function `PullRequestsService.ListCommits`: ✅ No usageThe The OpenAPI Schema defines the following: Conclusion: no usage of I have a few more structs to go through, but overall it looks like Stats inside Commit is never actually used in any circumstances. EDIT: I have checked all the structs. and usage and basically Stats is never used or I have missed something. It is never available through operations done by the GitService. Then Does that make sense to deprecate or even remove the field at all ? |
With this detailed analysis, I'm totally fine with you creating a PR to remove the field. Thank you for doing this deep dive, @acouvreur ! |
This field appears to never be populated throughout the codebase. Closes google#3394
The
CommitStats
in theCommit
struct is always nil.Comparing the current
Commit
struct:go-github/github/git_commits.go
Lines 44 to 62 in c4a49db
With the GitHub OpenAPI Spec:

The
Stats
field is not on the OpenAPI Contract.I know that structs can be used to represents objects that look alike a lot (hence the
CommentCount
field).So I'm not sure if the
Stats
field is also one of these exceptions. If that's the case, it should be explained just likeCommentCount
.The text was updated successfully, but these errors were encountered: