Skip to content

Conversation

estebanlm
Copy link
Collaborator

this allows me to make a diff compare using lib git mechanism. Is barebones but it may be used in the future to enhance some merge info.
Usage:

LGitLibrary uniqueInstance initializeLibGit2.

s1 := 'xx1
yy
zz'.
s2 := 'xx2
xy
zz'.

diff := LGitDiff basicNew.

opts := LGitDiffOptions defaults.

lines := OrderedCollection new.
lineCallback := LGitDiffLineCallback on: [ :delta :hunk :line :payload |
	lines add: { line prim_origin. line prim_new_lineno. line content }. 
	0 ].

diff 
	diff_buffers: s1 
	old_len: s1 size  
	old_as_path: 'old.st' 
	new_buffer: s2 
	new_len: s2 size 
	new_as_path: 'new.st' 
	options: opts 
	file_cb: ExternalAddress null 
	binary_cb: ExternalAddress null
	hunk_cb: ExternalAddress null
	line_cb: lineCallback 
	payload: ExternalAddress null. "a LGitReturnCodeEnum(#git_ok [0])"

lines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant