Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Get stagedness from git #1

Merged
merged 4 commits into from
Feb 2, 2016
Merged

Get stagedness from git #1

merged 4 commits into from
Feb 2, 2016

Conversation

joshaber
Copy link
Contributor

@joshaber joshaber commented Feb 1, 2016

@benogle This seems to do The Right Thing®. If a line is staged on the command line, we show it as staged in the diff.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@benogle
Copy link
Contributor

benogle commented Feb 2, 2016

Ok, i'll tinker with getting it updating the stage when staging in the UI, then updating the interface again to see wtf happens.

benogle added a commit that referenced this pull request Feb 2, 2016
@benogle benogle merged commit f7e49ec into master Feb 2, 2016
@@ -91,4 +91,10 @@ export default class HunkLine {
if (line.newLineno() > 0) this.newLineNumber = line.newLineno()
this.emitChangeEvent()
}

static fromGitUtilsObject(obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this isnt used. yar? nar?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benogle
Copy link
Contributor

benogle commented Feb 2, 2016

So it seems git changes the line numbers in some cases. I remember this from when I was fighting with it. Make 3 changes so there are 3 hunks (see the file in fixtures dir for an example), stage the middle hunk, and part of the last hunk.

What's staged:

screen shot 2016-02-01 at 5 15 35 pm

The lines the git package thinks are staged:

screen shot 2016-02-01 at 5 16 01 pm

Whats shown in the interface:

screen shot 2016-02-01 at 5 17 06 pm

@benogle
Copy link
Contributor

benogle commented Feb 2, 2016

A totally crappy thing to do is change the test to check for line origin and content. Obv no bueno as multiple lines could have those properties.

return line.getContent() === hunkLine.getContent() &&
               line.getLineOrigin() === hunkLine.getLineOrigin()

@joshaber joshaber deleted the show-stagedness branch February 2, 2016 15:31
@joshaber
Copy link
Contributor Author

joshaber commented Feb 2, 2016

Yeah, great example 👍 I knew it couldn't be that easy!

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

Successfully merging this pull request may close these issues.

None yet

2 participants