Skip to content

Diff Line Model Object #112

Merged
merged 8 commits into from Dec 21, 2012

4 participants

@dannygreg

When using the new diff API it was pretty inconvenient that we didn't actually represent a line as a model object at any point, but rather just passed all of it's components separately into the enumeration block.

This changes that, representing a line as an object.

@joshaber joshaber was assigned Dec 20, 2012
@alanjrogers

Looks pretty good to me. Could do with some unit tests for the new class though. (yes I'm back 💃)

@jspahrsummers jspahrsummers and 1 other commented on an outdated diff Dec 21, 2012
Classes/GTDiffLine.h
+// A character representing the origin of a given line.
+//
+// See diff.h for individual documentation.
+typedef enum : git_diff_line_t {
+ GTDiffLineOriginContext = GIT_DIFF_LINE_CONTEXT,
+ GTDiffLineOriginAddition = GIT_DIFF_LINE_ADDITION,
+ GTDiffLineOriginDeletion = GIT_DIFF_LINE_DELETION,
+ GTDiffLineOriginAddEOFNewLine = GIT_DIFF_LINE_ADD_EOFNL,
+ GTDiffLineOriginDeleteEOFNewLine = GIT_DIFF_LINE_DEL_EOFNL,
+} GTDiffLineOrigin;
+
+// Represents an individual line in a diff hunk.
+@interface GTDiffLine : NSObject
+
+// The content string of the line.
+@property (nonatomic, readonly) NSString *content;
@dannygreg
dannygreg added a note Dec 21, 2012

Nice catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dannygreg

@alanjrogers it isn't split out, but this is unit tested in the diff unit tests. Although the more the merrier I guess :p

@dannygreg

🈺

@jspahrsummers

Looks good to me.

@alanjrogers?

@dannygreg

I presumed he was a 👍 with his above comment.

@jspahrsummers

I'd like to give him the opportunity to reply about the tests.

@dannygreg

I feel the need for :shipit:

@jspahrsummers

You can just pin to this branch from your other work. :P

@dannygreg

Yeah I already am but it's not quite like a PR getting merged man. It's my crack. :p

@alanjrogers alanjrogers merged commit 0bbc548 into master Dec 21, 2012
@alanjrogers alanjrogers deleted the diff-line branch Dec 21, 2012
@alanjrogers

Crack administered 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.