update documentation for new zdiff3 conflictStyle

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2021-12-01 00:05:07 +00:00 коммит произвёл Junio C Hamano
Родитель 4496526f80
Коммит ddfc44a898
9 изменённых файлов: 50 добавлений и 21 удалений

Просмотреть файл

@ -4,7 +4,14 @@ merge.conflictStyle::
shows a `<<<<<<<` conflict marker, changes made by one side,
a `=======` marker, changes made by the other side, and then
a `>>>>>>>` marker. An alternate style, "diff3", adds a `|||||||`
marker and the original text before the `=======` marker.
marker and the original text before the `=======` marker. The
"merge" style tends to produce smaller conflict regions than diff3,
both because of the exclusion of the original text, and because
when a subset of lines match on the two sides they are just pulled
out of the conflict region. Another alternate style, "zdiff3", is
similar to diff3 but removes matching lines on the two sides from
the conflict region when those matching lines appear near either
the beginning or end of a conflict region.
merge.defaultToUpstream::
If merge is called without any commit argument, merge the upstream

Просмотреть файл

@ -266,8 +266,7 @@ When switching branches with `--merge`, staged changes may be lost.
The same as `--merge` option above, but changes the way the
conflicting hunks are presented, overriding the
`merge.conflictStyle` configuration variable. Possible values are
"merge" (default) and "diff3" (in addition to what is shown by
"merge" style, shows the original contents).
"merge" (default), "diff3", and "zdiff3".
-p::
--patch::

Просмотреть файл

@ -70,6 +70,9 @@ OPTIONS
--diff3::
Show conflicts in "diff3" style.
--zdiff3::
Show conflicts in "zdiff3" style.
--ours::
--theirs::
--union::

Просмотреть файл

@ -240,7 +240,8 @@ from the RCS suite to present such a conflicted hunk, like this:
------------
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed.
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
@ -261,16 +262,37 @@ side wants to say it is hard and you'd prefer to go shopping, while the
other side wants to claim it is easy.
An alternative style can be used by setting the "merge.conflictStyle"
configuration variable to "diff3". In "diff3" style, the above conflict
may look like this:
configuration variable to either "diff3" or "zdiff3". In "diff3"
style, the above conflict may look like this:
------------
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed.
ancestor, or cleanly resolved because only one side changed,
<<<<<<< yours:sample.txt
or cleanly resolved because both sides changed the same way.
Conflict resolution is hard;
let's go shopping.
||||||| base:sample.txt
or cleanly resolved because both sides changed identically.
Conflict resolution is hard.
=======
or cleanly resolved because both sides changed the same way.
Git makes conflict resolution easy.
>>>>>>> theirs:sample.txt
And here is another line that is cleanly resolved or unmodified.
------------
while in "zdiff3" style, it may look like this:
------------
Here are lines that are either unchanged from the common
ancestor, or cleanly resolved because only one side changed,
or cleanly resolved because both sides changed the same way.
<<<<<<< yours:sample.txt
Conflict resolution is hard;
let's go shopping.
|||||||
||||||| base:sample.txt
or cleanly resolved because both sides changed identically.
Conflict resolution is hard.
=======
Git makes conflict resolution easy.

Просмотреть файл

@ -714,9 +714,9 @@ information about the rebased commits and their parents (and instead
generates new fake commits based off limited information in the
generated patches), those commits cannot be identified; instead it has
to fall back to a commit summary. Also, when merge.conflictStyle is
set to diff3, the apply backend will use "constructed merge base" to
label the content from the merge base, and thus provide no information
about the merge base commit whatsoever.
set to diff3 or zdiff3, the apply backend will use "constructed merge
base" to label the content from the merge base, and thus provide no
information about the merge base commit whatsoever.
The merge backend works with the full commits on both sides of history
and thus has no such limitations.

Просмотреть файл

@ -92,8 +92,7 @@ in linkgit:git-checkout[1] for details.
The same as `--merge` option above, but changes the way the
conflicting hunks are presented, overriding the
`merge.conflictStyle` configuration variable. Possible values
are "merge" (default) and "diff3" (in addition to what is
shown by "merge" style, shows the original contents).
are "merge" (default), "diff3", and "zdiff3".
--ignore-unmerged::
When restoring files on the working tree from the index, do

Просмотреть файл

@ -137,8 +137,7 @@ should result in deletion of the path).
The same as `--merge` option above, but changes the way the
conflicting hunks are presented, overriding the
`merge.conflictStyle` configuration variable. Possible values are
"merge" (default) and "diff3" (in addition to what is shown by
"merge" style, shows the original contents).
"merge" (default), "diff3", and "zdiff3".
-q::
--quiet::

Просмотреть файл

@ -14,9 +14,9 @@ conflicts before writing them to the rerere database.
Different conflict styles and branch names are normalized by stripping
the labels from the conflict markers, and removing the common ancestor
version from the `diff3` conflict style. Branches that are merged
in different order are normalized by sorting the conflict hunks. More
on each of those steps in the following sections.
version from the `diff3` or `zdiff3` conflict styles. Branches that
are merged in different order are normalized by sorting the conflict
hunks. More on each of those steps in the following sections.
Once these two normalization operations are applied, a conflict ID is
calculated based on the normalized conflict, which is later used by
@ -42,8 +42,8 @@ get a conflict like the following:
>>>>>>> AC
Doing the analogous with AC2 (forking a branch ABAC2 off of branch AB
and then merging branch AC2 into it), using the diff3 conflict style,
we get a conflict like the following:
and then merging branch AC2 into it), using the diff3 or zdiff3
conflict style, we get a conflict like the following:
<<<<<<< HEAD
B

Просмотреть файл

@ -1517,7 +1517,7 @@ static struct option *add_common_options(struct checkout_opts *opts,
OPT_BOOL(0, "progress", &opts->show_progress, N_("force progress reporting")),
OPT_BOOL('m', "merge", &opts->merge, N_("perform a 3-way merge with the new branch")),
OPT_STRING(0, "conflict", &opts->conflict_style, N_("style"),
N_("conflict style (merge or diff3)")),
N_("conflict style (merge, diff3, or zdiff3)")),
OPT_END()
};
struct option *newopts = parse_options_concat(prevopts, options);