private int LineCallback(GitDiffDelta delta, GitDiffRange range, GitDiffLineOrigin lineorigin, IntPtr content, UIntPtr contentlen, IntPtr payload) { string decodedContent = Utf8Marshaler.FromNative(content, (int)contentlen); string prefix; switch (lineorigin) { case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION: LinesAdded++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION: LinesDeleted++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_CONTEXT: prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; default: prefix = string.Empty; break; } AppendToPatch(prefix); AppendToPatch(decodedContent); return 0; }
private int HunkCallback(GitDiffDelta delta, GitDiffHunk hunk, IntPtr payload) { string decodedContent = LaxUtf8Marshaler.FromBuffer(hunk.Header, (int)hunk.HeaderLen); AppendToPatch(decodedContent); return 0; }
private int HunkCallback(GitDiffDelta delta, GitDiffRange range, IntPtr header, UIntPtr headerlen, IntPtr payload) { string decodedContent = Utf8Marshaler.FromNative(header, (int)headerlen); AppendToPatch(decodedContent); return 0; }
private int FileCallback(GitDiffDelta delta, float progress, IntPtr payload) { IsBinaryComparison = delta.IsBinary(); if (!IsBinaryComparison) { return 0; } AppendToPatch("Binary content differ\n"); return 0; }
internal TreeEntryChanges(GitDiffDelta delta) { Path = LaxFilePathMarshaler.FromNative(delta.NewFile.Path).Native; OldPath = LaxFilePathMarshaler.FromNative(delta.OldFile.Path).Native; Mode = (Mode)delta.NewFile.Mode; OldMode = (Mode)delta.OldFile.Mode; Oid = delta.NewFile.Id; OldOid = delta.OldFile.Id; Status = (delta.Status == ChangeKind.Untracked || delta.Status == ChangeKind.Ignored) ? ChangeKind.Added : delta.Status; }
public static bool IsBinary(this GitDiffDelta delta) { return(delta.Flags.HasFlag(GitDiffFlags.GIT_DIFF_FLAG_BINARY)); }
private int FileCallback(IntPtr data, GitDiffDelta delta, float progress) { IsBinaryComparison = IsBinaryDelta(delta); if (!IsBinaryComparison) { return 0; } PatchBuilder.Append("Binary content differ\n"); return 0; }
internal static bool IsBinaryDelta(GitDiffDelta delta) { //TODO Fix the interop issue on amd64 and use GitDiffDelta.Binary return delta.OldFile.Flags.Has(GitDiffFileFlags.GIT_DIFF_FILE_BINARY) || delta.NewFile.Flags.Has(GitDiffFileFlags.GIT_DIFF_FILE_BINARY); }
private int LineCallback(IntPtr data, GitDiffDelta delta, GitDiffRange range, GitDiffLineOrigin lineorigin, IntPtr content, IntPtr contentlen) { string decodedContent = NativeToString(content, contentlen); string prefix; switch (lineorigin) { case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION: LinesAdded++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION: LinesDeleted++; prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; case GitDiffLineOrigin.GIT_DIFF_LINE_CONTEXT: prefix = Encoding.ASCII.GetString(new[] { (byte)lineorigin }); break; default: prefix = string.Empty; break; } PatchBuilder.AppendFormat("{0}{1}", prefix, decodedContent); return 0; }
private int HunkCallback(IntPtr data, GitDiffDelta delta, GitDiffRange range, IntPtr header, IntPtr headerlen) { string decodedContent = NativeToString(header, headerlen); PatchBuilder.AppendFormat("{0}", decodedContent); return 0; }
public static bool IsBinary(this GitDiffDelta delta) { //TODO Fix the interop issue on amd64 and use GitDiffDelta.Binary return(delta.OldFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY) || delta.NewFile.Flags.HasFlag(GitDiffFileFlags.GIT_DIFF_FLAG_BINARY)); }