GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Misc cleanups on git command invocation by cklin · Pull Request #2521 · github/codeql-action

Conversation

@cklin

@cklin cklin commented Oct 3, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This PR contains two cleanups related to how the action invokes git commands.

  • The first commit extracts a runGitCommand() function, which reduces code duplication among functions that call git.
  • The second commit renames determineMergeBaseCommitOid() so that its name more clearly matches what it does.

This PR is intended to be a refactoring, but there are some changes to git-invocation error messages.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
cklin added 2 commits October 3, 2024 08:29
@cklin
Extract runGitCommand()
955d001
@cklin
Rename determineMergeBaseCommitOid()
d64cca4
The name suggests that the function computes the merge base, which for
Git means specifically the best common ancestors between multiple
commits or branches (see `git merge-base`).

But what the function actually does is to calculate the HEAD commit of
the PR base branch, as derived from the PR merge commit that the action
analyzes. So even though the function has to do with "merge" and "base",
using the term "merge base" is still misleading at best.

This commit renames the function to determineBaseBranchHeadCommitOid(),
which more clearly indicates what the function does.
@cklin
cklin marked this pull request as ready for review October 3, 2024 16:34
@cklin
cklin requested a review from a team as a code owner October 3, 2024 16:34
angelapwen
angelapwen approved these changes Oct 3, 2024
View reviewed changes

@angelapwen angelapwen left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for the refactor! Renaming seems a lot clearer now too 😸

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cklin
cklin merged commit 8b33300 into main Oct 3, 2024
@cklin
cklin deleted the cklin/run-git-command branch October 3, 2024 20:40
This was referenced Oct 7, 2024
Merge main into releases/v3 #2529
Merged
Merge releases/v3 into releases/v2 #2531
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@angelapwen angelapwen angelapwen approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cklin @angelapwen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.