Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 922
added lines and deleted lines in content changes#1790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
79e11b992b9e20445bbbe70b6bd73c777dc9733e7437fa5858196539a9d5c36c5bd90a34a65c3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics; | ||
| using System.Globalization; | ||
| using System.Text; | ||
| @@ -51,6 +52,16 @@ internal void AppendToPatch(string patch) | ||
| /// </summary> | ||
| public virtual int LinesDeleted { get; internal set; } | ||
| /// <summary> | ||
| /// The list of added lines. | ||
| /// </summary> | ||
| public virtual List<Line> AddedLines { get; } = new List<Line>(); | ||
| /// <summary> | ||
| /// The list of deleted lines. | ||
| /// </summary> | ||
| public virtual List<Line> DeletedLines { get; } = new List<Line>(); | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the extra line Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still need to clean up this extra line break. | ||
| /// <summary> | ||
| /// The patch corresponding to these changes. | ||
| /// </summary> | ||
| @@ -95,11 +106,13 @@ private unsafe int LineCallback(git_diff_delta* delta, GitDiffHunk hunk, GitDiff | ||
| switch (line.lineOrigin) | ||
| { | ||
| case GitDiffLineOrigin.GIT_DIFF_LINE_ADDITION: | ||
| AddedLines.Add(new Line(line.NewLineNo, decodedContent)); | ||
| LinesAdded++; | ||
| prefix = Encoding.ASCII.GetString(new[] { (byte)line.lineOrigin }); | ||
| break; | ||
| case GitDiffLineOrigin.GIT_DIFF_LINE_DELETION: | ||
| DeletedLines.Add(new Line(line.OldLineNo, decodedContent)); | ||
| LinesDeleted++; | ||
| prefix = Encoding.ASCII.GetString(new[] { (byte)line.lineOrigin }); | ||
| break; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| namespace LibGit2Sharp | ||
| { | ||
| /// <summary> | ||
| /// Represents a line with line number and content. | ||
| /// </summary> | ||
| public struct Line | ||
| { | ||
| /// <summary> | ||
| /// The line number of the original line in the blob. | ||
| /// </summary> | ||
| public int LineNumber { get; } | ||
| /// <summary> | ||
| /// The content of the line in the original blob. | ||
| /// </summary> | ||
| public string Content { get; } | ||
| internal Line(int lineNumber, string content) | ||
| { | ||
| LineNumber = lineNumber; | ||
| Content = content; | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.