pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

How exactly use IndexEntry

Open PUYUP opened this issue 4 years ago • 0 comments

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.

PUYUP avatar Nov 30 '20 23:11 PUYUP