Skip to content

Commit leaves inverted index, and Reset jumps back too far #1412

Closed
@AArnott

Description

@AArnott

Nerdbank.GitVersioning has tests that pass when run with libgit2sharp 0.22.0, but one test (GetVersionHeight_VersionJsonHasParsingErrorsInHistory) fails when run against 0.23.1.

Specifically, it appears that when I call

this.Repo.Index.Add(relativeFilePath);
this.Repo.Commit("some text");

This leaves the repo in an odd state. The commit is made, but then the inverse of that commit is staged to the index.

Later, when I call Reset to move the head and index back one step but without touching the work tree,

this.Repo.Reset(ResetMode.Mixed, this.Repo.Head.Commits.Skip(1).First());

This jumps HEAD all the way back to the start of the repo (2 steps instead of just 1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions