Objective-Git Merge

 蔡晓楠 发布于 2023-02-05 09:39

我正在使用Objective-Git.我无法使用以下方法:

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

没有返回错误,但返回的索引为空,当它存在时,所有属性都为零.合并操作不会发生,我无法写出树,因为我无法获得尝试合并产生的索引.

有没有人设法使用目标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);
        }
    }
}

Arthur Schre.. 5

通过将树合并在一起返回的索引不会绑定到存储库.不幸的是,将索引作为树写入特定存储库(git_index_write_tree_to)的操作尚未通过Objective-Git公开.

您可能希望在其问题跟踪器中打开票证.

1 个回答
  • 通过将树合并在一起返回的索引不会绑定到存储库.不幸的是,将索引作为树写入特定存储库(git_index_write_tree_to)的操作尚未通过Objective-Git公开.

    您可能希望在其问题跟踪器中打开票证.

    2023-02-05 09:46 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有