How exactly use IndexEntry
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 408
- Avg merge
- 2d 57m
- Merged PRs (30d)
- 7
Description
Trying adding file with IndexEntry, this my way:
id = repo.create_blob('foo bar')
entry = pygit2.IndexEntry('zend2.txt', id, pygit2.GIT_FILEMODE_BLOB_EXECUTABLE)
repo.index.add(entry)
repo.index.write()
But with git status return this.
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: zend2.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: zend2.txt
How to add that blob to staged index.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the IndexEntry example and the repo.index.add/write calls shown in the issue, then compare the index state with the displayed git status output. Document or verify the correct way to stage the created blob, with completion shown by git status reporting only the intended staged file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python
- Domain
- devtools
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100