libgit2 / libgit2/libgit2sharp

Using CherryPick with CommitOnSuccess = false

Open
#1,774 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

Reproduction steps
using (var repo = new Repository("path\to\repo"))
            {
                var commit1 = repo.Lookup<Commit>("a05b011d89bbd5c9117840b71718ce2a1ee00376");

                var masterTb = repo.Branches["refs/remotes/origin/release/1.0"];
                var master = repo.CreateBranch("release/1.0", masterTb.Tip);

                var updateMb = repo.Branches.Update(master,
                  b => b.TrackedBranch = masterTb.CanonicalName);

                Commands.Checkout(repo, updateMb);

                var result = repo.CherryPick(commit1, commit1.Author, new CherryPickOptions { CommitOnSuccess = false});
}

If i use CherryPick with CommitOnSuccess = false repo is left in cherry-pick state. For rebase there is abort and continue commands, but for cherry pick there is non.

I checked up code and if i use CommitOnSuccess = true there is git_repository_state_cleanup which clean up chery-pick state.

Is this a bug or there is some commands to reset state?

Expected behavior

cherry picked and exit cherry-pick state

Actual behavior

left in cherry-pick state

Version of LibGit2Sharp (release number or SHA1)

0.26.2

Operating system(s) tested; .NET runtime tested

Windows 10 Version 2004 10.0.19041
.Net Core 3.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Repository.CherryPick API and its CherryPickOptions handling; compare the CommitOnSuccess=false path with the rebase abort/continue behavior and the git_repository_state_cleanup call described in the report. Reproduce the supplied snippet against LibGit2Sharp 0.26.2; done means the repository no longer remains in cherry-pick state, or the supported reset behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.