pygit2
pygit2 copied to clipboard
How exactly use IndexEntry
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.