Skip to content

Use "git cherry-pick" for implementing copy/paste of commits #4443

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

Open
wants to merge 4 commits into
base: show-revert-and-cherry-pick-todos
Choose a base branch
from

Conversation

stefanhaller
Copy link
Collaborator

  • PR Description

This is part three of a four part series of PRs that improve the cherry-pick and revert experience.

With this PR we reimplement copy/paste of commits to use git cherry-pick under the hood. We do this because

  • it's closer to what you would do on the command line
  • it simplifies the code a bit
  • it allows us to support cherry-picking merge commits.

Fixes #1374
Fixes #3317

  • Please check if the PR fulfills these requirements
  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

@stefanhaller stefanhaller added the enhancement New feature or request label Mar 31, 2025
@stefanhaller stefanhaller force-pushed the show-revert-and-cherry-pick-todos branch from cd2e83f to a8eefbc Compare March 31, 2025 17:39
@stefanhaller stefanhaller force-pushed the implement-cherry-picking-with-git-cherry-pick branch 2 times, most recently from d81bb8b to e30f7b4 Compare March 31, 2025 19:19
Copy link

codacy-production bot commented Mar 31, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% 97.44%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c1143a2) 54958 47724 86.84%
Head commit (417080e) 54958 (+0) 47726 (+2) 86.84% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4443) 78 76 97.44%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@stefanhaller stefanhaller force-pushed the show-revert-and-cherry-pick-todos branch from a8eefbc to d88dd37 Compare April 5, 2025 09:26
@stefanhaller stefanhaller force-pushed the implement-cherry-picking-with-git-cherry-pick branch from e30f7b4 to 3ff8f5c Compare April 5, 2025 09:26
@stefanhaller stefanhaller force-pushed the show-revert-and-cherry-pick-todos branch from d88dd37 to 57d7c9e Compare April 7, 2025 12:42
@stefanhaller stefanhaller force-pushed the implement-cherry-picking-with-git-cherry-pick branch from 3ff8f5c to fb458bb Compare April 7, 2025 12:43
…ing new ones

Previously we would create new Commit objects to store in the CherryPicking mode
which only contained a name and hash, all other fields were unset. I'm not sure
why we did this; it's easier to just reference the original commits. Later on
this branch we will need this because we need to determine whether a copied
commit was a merge commit (by looking at its Parents field).
We do this because
- it's closer to what you would do on the command line
- it simplifies the code a bit
- it will allow us to support cherry-picking merge commits.
Now that we use git cherry-pick to implement it, there's no reason not to.
@stefanhaller stefanhaller force-pushed the show-revert-and-cherry-pick-todos branch from 57d7c9e to c1143a2 Compare April 10, 2025 09:53
@stefanhaller stefanhaller force-pushed the implement-cherry-picking-with-git-cherry-pick branch from fb458bb to 417080e Compare April 10, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant