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

FR: add additional information after conflict markers #3416

Closed
poliorcetics opened this issue Apr 1, 2024 · 1 comment
Closed

FR: add additional information after conflict markers #3416

poliorcetics opened this issue Apr 1, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request polish🪒🐃 Make existing features more convenient and more consistent

Comments

@poliorcetics
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

Example of a conflict currently:

<<<<<<<
%%%%%%%
-        let git: Box<dyn DiffProvider> = Box::new(Git);
-        let providers = vec![git];
+        let providers = vec![Git.into()];
+++++++
        #[cfg(feature = "git")]
        let git: Box<dyn DiffProvider> = Box::new(git::Git);
        let providers = vec![
            #[cfg(feature = "git")]
            git,
        ];
>>>>>>>

The issue here is that I don't remember where I was coming from since it's been some time since I last touched this.

Describe the solution you'd like

Adding some more information allowing to know what comes from where and to look for information could be very useful.

Suggestion:

<<<<<<< base: wuurqlntozxqr (main); conflict: uvponskzxlpzot
%%%%%%% diff: wuurqlntozxqr (-) to uvponskzxlpzot (+)
-        let git: Box<dyn DiffProvider> = Box::new(Git);
-        let providers = vec![git];
+        let providers = vec![Git.into()];
+++++++ added in uvponskzxlpzot
        #[cfg(feature = "git")]
        let git: Box<dyn DiffProvider> = Box::new(git::Git);
        let providers = vec![
            #[cfg(feature = "git")]
            git,
        ];
>>>>>>>

In practice something of the form:

<<<<<<< base: CHANGE_ID_BASE (branch names, if any) ; conflict: CHANGE_ID_CONFLICT
%%%%%%% diff: CHANGE_ID_BASE (-) to CHANGE_ID_CONFLICT (+)
------- removed in CHANGE_ID_X
+++++++ added in CHANGE_ID_X

Describe alternatives you've considered

  1. Do nothing: this works but information is missing that could be useful to understand conflict markers

Additional context

Git does something similar:

$ git init \
  && git branch -m main \
  && echo -e "Foo\nHello" > file.txt \
  && git add file.txt \
  && git commit -m "a" \
  && git branch new-branch \
  && git switch new-branch \
  && echo -e "Bar\nFarwell" > file.txt \
  && git add file.txt \
  && git commit -m "b" \
  && git switch main \
  && echo -e "Bar\nHello" > file.txt \
  && git add file.txt \
  && git commit -m "c" \
  && git merge new-branch
$ cat file.txt

Bar
<<<<<<< HEAD
Hello
||||||| 492f92b
Foo
Hello
=======
Farwell
>>>>>>> new-branch

Here this is a merge so:

  • HEAD is the local change
  • 492f92b is the common ancestor
  • new-branch is the remote change being merged
@poliorcetics poliorcetics added enhancement New feature or request polish🪒🐃 Make existing features more convenient and more consistent labels Apr 1, 2024
@ilyagr ilyagr self-assigned this Apr 1, 2024
@ilyagr
Copy link
Collaborator

ilyagr commented Apr 1, 2024

I'm actually working on a simpler version of this, see #1176 (comment). I think this is a duplicate of that bug; there are some difficulties you can read about in the discussion over there.

@ilyagr ilyagr closed this as completed Apr 1, 2024
@ilyagr ilyagr closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request polish🪒🐃 Make existing features more convenient and more consistent
Projects
None yet
Development

No branches or pull requests

2 participants