Skip to content
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

Ask for confirmation before staging unmerged file containing markers #464

Closed
albertdev opened this issue Jun 12, 2015 · 2 comments
Closed

Comments

@albertdev
Copy link

A feature request: everyone has it happen every few times that they're dealing with some Unmerged changes.

Sometimes I do make the mistake of double-clicking such a file in git-cola, which will automatically stage it with these markers:

<<<< HEAD
====
>>>> Updated / Stashed

Unstaging won't put it back in the "Unmerged" state though, meaning that I can no longer call git mergetool through the CLI or git-cola and I need to undo all those markers by hand.

Since I don't think git allows to put a file back to the Unmerged state, could git-cola detect that a file still has markers and ask the user for confirmation or even give the third option of opening the mergetool?

@albertdev
Copy link
Author

Ping! No comments on whether this is a good idea or at all possible?

@davvid
Copy link
Member

davvid commented Jul 1, 2015

This is a great idea. It's totally possible. When implementing, please make sure to also consider the "diff3"-style conflict markers, which are enabled by git config merge.conflictstyle diff3.

http://psung.blogspot.com/2011/02/reducing-merge-headaches-git-meets.html

davvid added a commit that referenced this issue Jul 17, 2015
Related-to: #464
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit that referenced this issue Jul 17, 2015
The "stage modified" and "stage untracked" actions can trigger a blind
"git add -u", which will happily add all unmerged files.

Guard against it.

Related-to: #464
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit that referenced this issue Jul 17, 2015
Teach git-cola to inspect unmerged files for conflict markers.
This feature helps prevent accidental staging of unresolved conflicts.

Related-to: #464
Suggested-by: Bert Jacobs <albert.devs@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid closed this as completed in 9b2d394 Jul 17, 2015
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

No branches or pull requests

2 participants