You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 2, 2026. It is now read-only.
The following code simply creates a blank index, adds 1 file to it, and checks the index for conflict. When running multiple times, once after another, the index will randomly have a conflict, and the conflicted entry will be the only entry, with a stage value of 3.
I would expect there never to be a conflict. Is this a bug or have I misunderstood a concept?
returnGit.Repository.init(this.repoPath,0).then(repo=>{returnGit.Index.open('randomindexpath').then(index=>{//create file entryvarfileContent=newBuffer("first file content");varnewFileOid=Git.Blob.createFromBuffer(repo,fileContent,fileContent.length);varfileEntry=newGit.IndexEntry();fileEntry.path='firstfile.txt';fileEntry.id=newFileOid;fileEntry.mode=Git.TreeEntry.FILEMODE.BLOB;//add entry to indexindex.add(fileEntry);if(index.hasConflicts()){thrownewError('Index is conflicted');}});});
I found that setting the index entry flags to 0 before adding to index seems to avoid the unexpected conflict state. Doing a dump showed that it might be left uninitialized otherwise, which probably confuses the add code.
Activity
petemill commentedon Dec 9, 2015
Added #820 which adds a test case, and enables
Git.Index.create()johnhaley81 commentedon Jan 21, 2016
This might be related to #827.
unframework commentedon Feb 28, 2016
I found that setting the index entry
flagsto0before adding to index seems to avoid the unexpected conflict state. Doing a dump showed that it might be left uninitialized otherwise, which probably confuses the add code.