libgit2 API では、追跡用にファイルを「追加」することと、変更されたファイルをステージング領域に追加することの間に違いはありますか?
これは、変更された追跡ファイルをステージングするために現在使用しているコードです。
int giterror = git_repository_index( &index, open_repo );
if( giterror != 0 )
{
return giterror;
}
// Refresh the index from disk to load the entries that may already be staged
giterror = git_index_read( index );
if( giterror != 0 )
{
git_index_free( index );
return giterror;
}
giterror = git_index_add_bypath( index, relativeFilePath );
if( giterror != 0 )
{
git_index_free( index );
return giterror;
}
// write updated index to disk - aka staging area
giterror = git_index_write( index );
if( giterror != 0 )
{
git_index_free( index );
return giterror;
}
// write the index of changes to a tree
git_oid rootTreetOID;
giterror = git_index_write_tree( &rootTreetOID, index );
if( giterror != 0 )
{
git_index_free( index );
return giterror;
}
同じコードを使用して、追跡されていないファイルをインデックスに追加する必要がありますか?