Added a modified file in git index but the file is not changing to staged

Viewed 156

I'm trying to add a file to index to create a commit with libgit2.

The repo and index are like that:

git_repository *repo;
git_index *my_repo_index;
git_repository_open(&repo, ".");
git_repository_index(&my_repo_index, repo);
git_index_add_bypath(my_repo_index,"a.txt");
//all functions are returning 0, or success.

The "a.txt" file already exists in the index and is a modified file.

Before the commit the file is under "Changes not staged for commit", and I thought that after that the file would be under "staged" like after I executed "git add a.txt" but that didn't happened.

Am I missing something?

1 Answers
Related