Skip to content

handle renames in commit view - #577

Merged
niik merged 15 commits into
masterfrom
file-list-mismatch
Nov 8, 2016
Merged

niik merged 15 commits into
masterfrom
file-list-mismatch

Conversation

@shiftkey

@shiftkey shiftkey commented Nov 2, 2016 •

Copy link
Copy Markdown
Member

Fixes #572

The underlying output from Git includes the rename detection percentage, as well as both file names when it is a rename:

  • fix parser to handle renames and copies
  • add regression test for handling copies when returned in history view

@niik

niik commented Nov 3, 2016

Copy link
Copy Markdown
Member

Doesn't the same thing apply to copies?

image

@niik niik self-assigned this Nov 3, 2016
@shiftkey

shiftkey commented Nov 3, 2016 •

Copy link
Copy Markdown
Member Author

@niik which commit was this for? I'll add it to my test suite

EDIT: oops, i see it's the same commit. let me go back to the raw Git output.

@shiftkey

shiftkey commented Nov 3, 2016

Copy link
Copy Markdown
Member Author

Putting this back to [WIP] while I go find where these CXXX results are being introduced in - I don't see these on the problem commit on macOS, nor when running the same command on Git 2.10.2.

@shiftkey shiftkey changed the title handle renames in commit view [WIP] handle renames in commit view Nov 3, 2016
This code change also ensures we detect renames with an additional value
for the percentage of content changed in the blob, e.g. R100, R084.
@shiftkey
shiftkey force-pushed the file-list-mismatch branch 2 times, most recently from 39f37c8 to 98698b8 Compare November 7, 2016 01:33
@shiftkey

shiftkey commented Nov 7, 2016

Copy link
Copy Markdown
Member Author

I'm puzzled at how the CXXX values were creeping into this output from the initial repro. We don't enable -C by default when generating the diff (or -M to find renames), but here's a gist of what it looks like when you enable it. It's a bit similar to what was initially reported, but I think we want to show the first list of files (without -C enabled) as that's how dotcom is doing it.

I'm happy that the file list matches what we're displaying on dotcom (it's now displaying 55 files), and some tests now cover rename detections, and I'll open some issues to track the other inconsistencies between the history view and the changes view.

@shiftkey shiftkey changed the title [WIP] handle renames in commit view handle renames in commit view Nov 7, 2016
@shiftkey

shiftkey commented Nov 7, 2016

Copy link
Copy Markdown
Member Author

🍎

@shiftkey shiftkey mentioned this pull request Nov 7, 2016
3 tasks done

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm puzzled at how the CXXX values were creeping into this output from the initial repro.

@joshvera Is it possible, seeing as you're a diff pro these days that you have diff.renames set to copies in your global or local git config?

@shiftkey Can we add a test where we set that config flag so that we cover the rename scenario?

Comment thread app/src/ui/changes/changed-file.tsx Outdated
case FileStatus.Renamed: return OcticonSymbol.diffRenamed
case FileStatus.Conflicted: return OcticonSymbol.alert
// TODO: we don't have an Octicon for when the diff is copied
case FileStatus.Copied: return OcticonSymbol.question

This comment was marked as spam.

@shiftkey

shiftkey commented Nov 8, 2016 •

Copy link
Copy Markdown
Member Author

@niik I can test the diff.renames theory on my side, but that seems a plausible reason...

EDIT: yup, it's that. I can suppress this by passing -c diff.renames=true to each command 🤘

@niik

niik commented Nov 8, 2016

Copy link
Copy Markdown
Member

EDIT: yup, it's that. I can suppress this by passing -c diff.renames=true to each command

I haven't had a chance to get familiarized with this yet but is there any particular reason why we'd need to suppress it as opposed to handling it?

@shiftkey

shiftkey commented Nov 8, 2016

Copy link
Copy Markdown
Member Author

I haven't had a chance to get familiarized with this yet but is there any particular reason why we'd need to suppress it as opposed to handling it?

We don't have a way within git log to say "we don't want renames" or "we don't want copies" so moving up to overriding the config was the next logical step.

@niik

niik commented Nov 8, 2016

Copy link
Copy Markdown
Member

We don't have a way within git log to say "we don't want renames" or "we don't want copies" so moving up to overriding the config was the next logical step.

Right, I'm just saying we don't we respect the users configuration options in this case? We do, after all, go to some lengths to render staged renames. Since it seems to me like we have everything in place to deal with copies? Why explicitly forbid them?

@shiftkey

shiftkey commented Nov 8, 2016

Copy link
Copy Markdown
Member Author

@niik two reasons come to mind

  • "this isn't how it looks on GitHub Dot Com The Website" - users worried about their history looking different
  • "is all the copies noise worth it?" - perhaps this is a @joshvera question more than mine, but looking at the second file in the gist and for example seeing test/corpus/diff-summaries/go/type-assertion-expression.json has been copied to a few places (with most percentages of the copies around 50-60%) feels rather noisy. We don't really have much horizontal space in the file list right now (I was going to open a discussion around that) but the classic output feels more sensible right now IMO.

@niik

niik commented Nov 8, 2016

Copy link
Copy Markdown
Member

First off, this is all pretty academic, either option is certainly fine so I'm happy to turn it off for now and maybe addressing it in the future. I guess it just feels odd to have code to deal with something that we then try our damnedest to ensure never happens. It's sort of like how we had FileStatus.Undefined even though there was no possible way that would get used.

I'm fine with turning it off for now, I'll play out my argument below while I have it fresh in my mind.


"this isn't how it looks on GitHub Dot Com The Website" - users worried about their history looking different

Would it look different though? Aren't we just rendering them as added files now? Also, wouldn't this only happen to very pro-users of Git that sets this particular option?

"is all the copies noise worth it?" - perhaps this is a @joshvera question more than mine, but looking at the second file in the gist and for example seeing test/corpus/diff-summaries/go/type-assertion-expression.json has been copied to a few places (with most percentages of the copies around 50-60%) feels rather noisy. We don't really have much horizontal space in the file list right now (I was going to open a discussion around that) but the classic output feels more sensible right now IMO.

I don't think that we should render copies any differently in the file list but preserving the state from Git could have some value for us. We will in all likelihood add a diff header that shows file name, rename info and potentially mode changes to the diffs anyway, that could be a place where we could surface this information if we wanted, something like foo.ts (68% similarity with bar.ts).

@shiftkey

shiftkey commented Nov 8, 2016

Copy link
Copy Markdown
Member Author

@niik yeah, I'm not really fussed on either approach. I can verify we're handling copies with a test, drop the config override and discuss the UX side further.

@shiftkey

shiftkey commented Nov 8, 2016

Copy link
Copy Markdown
Member Author

🌔

@niik
niik merged commit 26f76c1 into master Nov 8, 2016
@niik
niik deleted the file-list-mismatch branch November 8, 2016 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants