| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Change the log level of the "git call failed." message in `runGitCommand` from `core.info` to `core.debug` so repeated identical failures in non-git working directories no longer flood the normal output. Add a single `core.info` fallback notice in `getCommitOid` so callers still see one actionable message when git is unavailable. Update tests to assert the new debug-level logging. Fixes github#3383
There was a problem hiding this comment.
Hi @mvanhorn 👋🏻
Thanks for opening this PR! I think this is probably one of those innocent-seeming changes that's unfortunately a bit of a rabbit hole.
Typically, we expect that the CodeQL Action is run with reference to some Git repository. In the general case, we therefore want to know when that is not the case and git commands fail unexpectedly. The change here mostly just masks these unexpected failures, since runGitCommand is used by several callers and the change shifts the responsibility of communicating the failure from runGitCommand to the caller. See e.g. the comment in getGitRoot which notes that // Errors are already logged by runGitCommand() which would no longer be true with this change.
I agree with the comment in the issue that:
Ideally, the action should be able to "quickly" determine that there isn't a repository checked out and not waste additional time running git commands.
This seems feasible and we could then emit one warning about that and skip subsequent git calls. That's a more involved change than this one though.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When upload-sarif runs in a directory that is not a git repository, runGitCommand was calling core.info on every git call failure. Since callers such as getCommitOid and determineBaseBranchHeadCommitOid silently swallow the exception and fall back to environment variables, the same "not a git repository" diagnostic was emitted multiple times per run, adding noise without adding value.
This PR changes the log level in runGitCommand from core.info to core.debug so the full diagnostic is preserved for maintainers with debug logging enabled, but does not appear in normal output. A single core.info fallback notice is added in getCommitOid so callers still see exactly one actionable message when git is unavailable.
Fixes #3383.
Risk assessment
Which use cases does this change impact?
How did/will you validate this change?
If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist