Skip to content

gix::Repository::rev_parse_single doesn't agree with git for specs of the form @{-n} #2609

Description

Current behavior 😯

Running repo.rev_parse_single("@{-1}") in a repo where the last checked out branch has been deleted returns the object id of the commit (tip of branch before deletion)

Expected behavior 🤔

It should return an error

Git behavior

In this case, git rev-parse --verify @{-1} returns an errors: "fatal: Needed a single revision" and exit code 128.

Steps to reproduce 🕹

Prepare a test repo (with a branch that was previously checked out but is now deleted):

git init
git commit --allow-empty -m c1
git checkout -b prev-target       
git checkout -
git branch -d prev-target

And in this repo, run repo.rev_parse_single("@{-1}") or git rev-parse --verify @{-1} previously mentioned to observe the mismatch between gix and git

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