FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Index randomly has conflict · Issue #816 · nodegit/nodegit · GitHub

Repository navigation

Index randomly has conflict #816

Description

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?

return Git.Repository.init(this.repoPath, 0)
.then(repo => {

  return Git.Index.open('randomindexpath')
  .then(index => {

    //create file entry
    var fileContent = new Buffer("first file content");
    var newFileOid = Git.Blob.createFromBuffer(repo, fileContent, fileContent.length);
    var fileEntry = new Git.IndexEntry();
    fileEntry.path = 'firstfile.txt';
    fileEntry.id = newFileOid;
    fileEntry.mode = Git.TreeEntry.FILEMODE.BLOB;
    //add entry to index
    index.add(fileEntry);
    if (index.hasConflicts()) {
      throw new Error('Index is conflicted');
    }
  });
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL