I'm trying to replicate the CLI experience of `git checkout <SHA goes here>`. Using:
from dulwich import porcelain
repo = porcelain.clone(
source="
https://github.com/cclib/cclib",
target="cclib",
)
porcelain.checkout(repo=repo, target="4557cf6d8e3eafdf76e80daa4b5de0bdc4d8ec2c")
print(porcelain.status(repo=repo, untracked_files="all"))
prints:
GitStatus(staged={'add': [], 'delete': [], 'modify': [b'.github/workflows/docs.yml', b'.github/workflows/nix.yml', b'.github/workflows/pre-commit.yml', b'.github/workflows/publish.yml', b'.github/workflows/test_and_package.yml']}, unstaged=[], untracked=[])
which is confirmed by Git:
$ git status
Not currently on any branch.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .github/workflows/docs.yml
modified: .github/workflows/nix.yml
modified: .github/workflows/pre-commit.yml
modified: .github/workflows/publish.yml
modified: .github/workflows/test_and_package.yml
when the CLI experience of `git checkout 4557cf6d8e3eafdf76e80daa4b5de0bdc4d8ec2c` is:
$ git status
HEAD detached at 4557cf6d
nothing to commit, working tree clean
The head is correct, but the working tree is not what I expect. What else do I need to do?