Skip to content

improve conflict detection for binary files - #6063

Merged
outofambit merged 10 commits into
masterfrom
conflicts-reported-for-binary-file
Nov 6, 2018
Merged

outofambit merged 10 commits into
masterfrom
conflicts-reported-for-binary-file

Conversation

@shiftkey

@shiftkey shiftkey commented Oct 31, 2018 •

Copy link
Copy Markdown
Member

Overview

As binary files don't contain conflicted markers, we need a different technique to detect when these are "resolved" in Git - the command line seems to prefer staging the change, so maybe we need to do that?

🌵🌵🌵 Depends on #6074 and #6072, go review those first🌵🌵🌵

Relates to #6062

Description

Release notes

Notes: no-notes

@shiftkey

Copy link
Copy Markdown
Member Author

For reference, the command line flow is a bit tricky:

$ git status 
On branch make-a-change
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

	both modified:   my-cool-image.png

no changes added to commit (use "git add" and/or "git commit -a")

I then git add my-cool-image.png to indicate I want ours as part of the merge, but then it disappears from the status output:

$ git status 
On branch make-a-change
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Maybe that's fine for the purposes of this workflow?

@outofambit

Copy link
Copy Markdown
Contributor

I think we could do a standalone pr for a lib module to detect if a file is a binary or not. what do you think @shiftkey? (I'd like to help get this figured out and I want to make sure we can split up work sensibly)

@shiftkey

Copy link
Copy Markdown
Member Author

I think we could do a standalone pr for a lib module to detect if a file is a binary or not.

This is my primary focus right now, and I'll update this branch once I have things to show off. Feel free to dig into things from the UI end as I haven't started on that area yet.

@shiftkey

shiftkey commented Nov 1, 2018

Copy link
Copy Markdown
Member Author

@outofambit I've opened #6072 to get the right abstraction in place so that you can work on the UI for this.

@outofambit

Copy link
Copy Markdown
Contributor

@shiftkey thank you!

@shiftkey
shiftkey force-pushed the conflicts-reported-for-binary-file branch from f7282c0 to 10dd59f Compare November 1, 2018 16:39
@shiftkey shiftkey changed the title [WIP] improve conflict detection for binary files improve conflict detection for binary files Nov 1, 2018
@shiftkey
shiftkey force-pushed the conflicts-reported-for-binary-file branch from 039cfe4 to 0bcb584 Compare November 1, 2018 17:58
@shiftkey
shiftkey force-pushed the conflicts-reported-for-binary-file branch 2 times, most recently from c992053 to 9eeb692 Compare November 1, 2018 18:05
@shiftkey
shiftkey force-pushed the conflicts-reported-for-binary-file branch from 9eeb692 to 59f14b2 Compare November 1, 2018 18:08
@shiftkey

shiftkey commented Nov 1, 2018

Copy link
Copy Markdown
Member Author

Alright, I think this is ready for a first round of review. I'd like to get feedback on these parts:

  • do the changes make sense? I've had to incorporate a second git call to test for binary detection, and so there's now more details floating around in getStatus to understand
  • there's some new types in models/conflicts.ts that I've had to define as part of enhancing conflict detection - do they fit with your mental model of how Git conflicts work?
  • have I missed anything?

There's two tests for different binary conflicts currently, and I plan to add in some more tomorrow but the setup is tedious and I wanted to to focus on the code changes first.

@shiftkey shiftkey added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 1, 2018
@outofambit
outofambit self-requested a review November 1, 2018 20:07
@shiftkey shiftkey added this to the 1.5.0 milestone Nov 2, 2018
@iAmWillShepherd iAmWillShepherd self-assigned this Nov 2, 2018

@outofambit outofambit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is looking good to me. i like the new conflict state model and i think that could help simplify some component logic.

one comment on a small cleanup thing, and i'd like to see a couple unit tests for binary-files.ts, but i think @shiftkey is already on it.

I wonder if we can collapse the ConflictFileStatus, AppFileStatus.Conflicted and AppFileStatus.Resolved into a single field. Right now a ConflictFileStatus of null means no conflicts, but we don't know if there were ever conflicts without cross-referencing AppFileStatus. Perhaps we could remove AppFileStatus.Resolved and have a third (and maybe fourth) type for ConflictFileStatus that effectively means "resolved", so that a ConflictState of null would coincide with unconflicted files and there would be a single field to check for conflict information. What do you think?

Comment thread app/src/lib/git/status.ts Resolved
@shiftkey

shiftkey commented Nov 5, 2018

Copy link
Copy Markdown
Member Author

@outofambit yeah, i'm keen to see if we can keep moving towards an application-specific conflicts interface that makes sense. Happy to keep nudging things along while we're wrapping up 1.5.0.

outofambit
outofambit previously approved these changes Nov 5, 2018
@shiftkey

shiftkey commented Nov 6, 2018

Copy link
Copy Markdown
Member Author

@outofambit just had to resolve a conflict from #6081 that prevented this from being merge

@outofambit
outofambit merged commit e908448 into master Nov 6, 2018
@outofambit
outofambit deleted the conflicts-reported-for-binary-file branch November 6, 2018 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants