Pregunta

Estoy usando git objetivos.No puedo obtener el siguiente método para trabajar:

- (GTIndex *)merge:(GTTree *)otherTree ancestor:(GTTree *)ancestorTree error:(NSError **)error

No se devuelve ningún error, pero el índice devuelto está vacío, mientras existe, todos los atributos son nulos.La operación de combinación no tiene lugar, no puedo escribir un árbol, ya que no puedo obtener el índice resultante de la fusión intentada.

¿Alguien ha logrado realizar con éxito una fusión usando git objetivo?¡AYUDA!

        GTBranch *branch1 = branches[0];
        GTCommit *commit1 = [branch1 targetCommitAndReturnError:NULL];
        GTOID *oid1 =  commit1.OID;
        GTTree *tree1 = commit1.tree;

        GTBranch *branch2 = branches[1];
        GTCommit *commit2 = [branch2 targetCommitAndReturnError:NULL];
        GTTree *tree2 = commit2.tree;
        GTOID *oid2 =  commit2.OID;

        GTRepository *repo = branch1.repository;

        NSError *error;
        GTCommit *ancestor = [repo mergeBaseBetweenFirstOID:oid1 secondOID:oid2 error:&error];
        if (error){
            NSLog(@"%@", error.description);
        }
        GTTree *ancTree = ancestor.tree;
        NSError *someError;
        NSLog(@"attempting merge into ""%@"" from ""%@"" with ancestor ""%@""", commit2.message, commit1.message,ancestor.message);
        GTIndex *mergedIndex = [tree2 merge:tree1 ancestor: ancTree error:&someError];  //returns index not backed by existing repo --> index_file_path = nil,  all attributes of git_index are nil
        if (someError){
            NSLog(@"%@", someError.description);
        }
        NSError *theError;
        GTTree *mergedtree = [mergedIndex writeTree:&theError]; //can't write out the tree as the index given back by merge: ancestor: error: does not reference a repo
        if (theError){
            NSLog(@"%@",theError);
        }
    }
}

¿Fue útil?

Solución

El índice que se devuelve fusionando los árboles juntos no está vinculado al repositorio.Desafortunadamente, la operación para escribir el índice como árbol a un repositorio específico (git_index_write_tree_to) no está expuesto aún a través del git de objetivos.

Probablemente desee abrir un boleto en su rastreador de emisión .

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top