Expose Diff Hunks in API
Rather than doing string parsing, I'd prefer having diff hunks available to mess with.
cc @nulltoken
Should we expose the hunks themselves together with the text patch? Inside PatchEntryChanges or something similar?
@Therzok, I was wondering if ContentChanges, rather than PatchEntryChanges, could be a more convenient place.
I would try extending the HunkCallback, or LineCallBack: they receive the GitDiffHunk which already contains the line indexes:
internal class GitDiffHunk
{
public int OldStart;
public int OldLines;
public int NewStart;
public int NewLines;
public UIntPtr HeaderLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] Header;
}
So far, they only append the patch chunk to the string builder, and increment LinesAdded and LinesDeleted. They could also append the chunk beginning and ending line to a collection.
Sounds good to me!
Are there any news on this?
Sorry, @ransagy, I completely moved to other topics. But right, I should complete what I promised. @ale7canna, would you like to help me with this?
Is there any progress on this? We need this for a new feature we're building at https://github.com/stryker-mutator/stryker-net
@Therzok @arialdomartini Is there any progress on this topic? Is there a low-level API or similar that we can hack to get the hunks? The use case I have is to show the original and the current file including the changes made to it.
@todor-dk Sorry, I have completely moved to other topics. The same with @ale7canna I suppose. I hope someone working on this project may support your needs!
I'm thinking of providing a patch for this as I also need the function. Would it make more sense to create wrapper objects around all the data objects or would it be preferable that I make the objects public (where they don't have ptr variables)? I was thinking to implement it in a way so that people can just extend the needed interfaces and then will be called by the lib after starting the call.