Skip to content

Fixes to diff callback and additional merge methods

Alan requested to merge Knowles/libgit2-glib:master into master

The first patch fixes hunk=null which appears when calling diff.print like this.

!14 (de9b8262)

diff.print(Ggit.DiffFormatType.PATCH, ( delta,  hunk,  line) => {
	 GLib.debug("%d: %s, %s", line.get_new_lineno(), line.get_origin().to_string(), line.get_text());
	 return 0;
});

Second patch adds support for GitRepository.merge_base() - which finds the common ancestor between two branchs.

!14 (d9c7d99d)


Third patch adds support for GitRepository.merge() - which appears merges to commits(usually branches) into the working branch.

!14 (c897211e)

var mo = new Ggit.MergeOptions();
var co = new Ggit.CheckoutOptions();
var the_ref = repository.lookup_reference_dwim("refs/heads/master");
var ac = new Ggit.AnnotatedCommit.from_ref(this.repo, the_ref);
var commits =   new Ggit.AnnotatedCommit[] { ac };
repository.merge(commits, mo, co);
Edited by Alan

Merge request reports