Skip to content

Question about Index.conflictGet method #1193

Open

Description

@zyu539

Hi there,
When I was trying to use index.conflictAdd() to update the conflict files, I found ancestor_index, their_index and our_index are needed. However, I could only get their_index by using conflictGet() method and found no way to get the other two indexes. And I found in libgit2, git_index_conflict_get would help us get all the indexes. So is there any way in nodegit for us to find out are the 3 indexes?
Thanks a lot.

Activity

  1. changed the title [-]Question about Index.conflictAdd method[/-] [+]Question about Index.conflictGet method[/+] on Jan 22, 2017
  2. rcjsuen commented on Jan 23, 2017

    @rcjsuen
    Member

    @zyu539 The conflictGet(*) function only has one parameter in the promise but you can actually get all three IndexEntry instances from the parameter. Please see below.

    index.conflictGet("newFile.txt").then(function(conflict) {
      console.log(conflict.ancestor_out);
      console.log(conflict.our_out);
      console.log(conflict.their_out);
    }).catch(function(err) {
      console.log(err);
    });
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