質問

目的gitを使っています。次の方法で機能する方法ができません。

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

エラーが返されませんが、返されたインデックスは空ですが、存在する間はすべての属性はnilです。マージ操作は行われません、私は試みられたマージから生じるインデックスを取得できないのでツリーを書き出すことはできません。

は、客観的なgitを使ってマージを成功させることができました - どのようにしていますか?助けて!

        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);
        }
    }
}
.

役に立ちましたか?

解決

ツリーを合体して返されるインデックスはリポジトリにバインドされていません。残念ながら、インデックスを特定のリポジトリ(git_index_write_tree_to)にツリーとして書き込む操作は、目的のgitを介してまだ露出されません。

おそらく issue tracker

でチケットを開きたいのです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top