简体   繁体   中英

Using libgit2 to git pull merge commit (cpp)

I m trying to use libgit2 to made a pull/merge/push from and to a remote repository.

Unfortunatly look like i use it wrong.

So basically i do a pull, then try to merge it with merge_head_from_fetchhead

When i look at the result, the merge commit have two commit parent which are the same, and file from remote are missing.

Code is located here : Code on Gist : NotesModel.cpp line 85 The method trying to do the Pull Merge Push is void NotesModel::pullMergePush() Yeah i know, that s original :)

Thx a lot

You're never calling git_merge to do the merge. You're setting up a merge_head , which is what describes the changes you want to merge, then immediately freeing it.

You need to pass the merge_head to git_merge .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM