Open
Description
I'm not sure this is actually a bug: I might be misunderstanding something about the index functionality.
I'm trying to use a separate index for my operation so it is isolated from the state of the working tree.
Unfortunately, it appears that the current working tree is still changed.
If this is simply something I'm doing wrong, please let me know.
Reproduction steps:
- Initialize an empty repo, add a commit to have a head to work with
- Run the following:
import git, io, os
from gitdb.base import IStream
repo = git.Repo()
# Create a simple blob by hand for repro purposes
content_bytes = b"Test content"
istream = IStream(b'blob', len(content_bytes), io.BytesIO(content_bytes))
blob_binsha = repo.odb.store(istream).binsha
test_blob_obj = git.Blob(repo, blob_binsha, git.Blob.file_mode, "some/path.txt")
# Create a new index and add the blob
index = git.IndexFile.new(repo, repo.head.commit.tree)
index.add([test_blob_obj]) # This is the line that causes the issue
- Run
git status
Expected results:
nothing to commit, working tree clean
Actual results:
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: some/path.txt
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: some/path.txt
Environment:
- Python 3.13.3
- GitPython 3.1.44
- git 2.49.0
- Arch Linux
Metadata
Metadata
Assignees
Labels
No labels