Skip to content

Commit

Permalink
Make --remerge-diff the default
Browse files Browse the repository at this point in the history
Signed-off-by: Elijah Newren <[email protected]>
  • Loading branch information
newren committed Jun 28, 2024
1 parent 44c4042 commit 55d2018
Show file tree
Hide file tree
Showing 24 changed files with 478 additions and 46 deletions.
3 changes: 2 additions & 1 deletion Documentation/diff-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ remerge, r::
Remerge two-parent merge commits to create a temporary tree
object--potentially containing files with conflict markers
and such. A diff is then shown between that temporary tree
and the actual merge commit.
and the actual merge commit. This is implied by `-p` unless
a different diff-merges option is passed.
+
The output emitted when this option is used is subject to change, and
so is its interaction with other options (unless explicitly
Expand Down
6 changes: 3 additions & 3 deletions Documentation/git-show.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ DESCRIPTION
-----------
Shows one or more objects (blobs, trees, tags and commits).

For commits it shows the log message and textual diff. It also
presents the merge commit in a special format as produced by
'git diff-tree --cc'.
By default, for non-merge commits it shows the log message and textual
diff and for merge commits it shows the log message and a diff against
a remerge.

For tags, it shows the tag message and the referenced objects.

Expand Down
5 changes: 4 additions & 1 deletion builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ static void show_setup_revisions_tweak(struct rev_info *rev)
if (rev->first_parent_only)
diff_merges_default_to_first_parent(rev);
else
diff_merges_default_to_dense_combined(rev);
diff_merges_default_to_remerge_diff(rev);
if (!rev->diffopt.output_format)
rev->diffopt.output_format = DIFF_FORMAT_PATCH;
}
Expand Down Expand Up @@ -913,6 +913,9 @@ static void log_setup_revisions_tweak(struct rev_info *rev)

if (rev->first_parent_only)
diff_merges_default_to_first_parent(rev);
else if (rev->diffopt.output_format)
/* Make -p imply --remerge-diff */
diff_merges_default_to_remerge_diff(rev);
}

int cmd_log(int argc, const char **argv, const char *prefix)
Expand Down
6 changes: 6 additions & 0 deletions diff-merges.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ void diff_merges_default_to_dense_combined(struct rev_info *revs)
set_dense_combined(revs);
}

void diff_merges_default_to_remerge_diff(struct rev_info *revs)
{
if (!revs->explicit_diff_merges)
revs->remerge_diff = 1;
}

void diff_merges_set_dense_combined_if_unset(struct rev_info *revs)
{
if (!revs->combine_merges)
Expand Down
2 changes: 2 additions & 0 deletions diff-merges.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ void diff_merges_default_to_first_parent(struct rev_info *revs);

void diff_merges_default_to_dense_combined(struct rev_info *revs);

void diff_merges_default_to_remerge_diff(struct rev_info *revs);

void diff_merges_set_dense_combined_if_unset(struct rev_info *revs);

void diff_merges_setup_revs(struct rev_info *revs);
Expand Down
2 changes: 1 addition & 1 deletion t/t3430-rebase-merges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ test_expect_success 'octopus merges' '
test_tick &&
git rebase -i --force-rebase -r HEAD^^ &&
test "Hank" = "$(git show -s --format=%an HEAD)" &&
test "Hank" = "$(git show -s --cc --format=%an HEAD)" &&
test "$before" != $(git rev-parse HEAD) &&
test_cmp_graph HEAD^^.. <<-\EOF
*-. Tüntenfüsch
Expand Down
1 change: 1 addition & 0 deletions t/t4013-diff-various.sh
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ show initial
show --root initial
show side
show master
show --cc master
show -c master
show -m master
show --first-parent master
Expand Down
21 changes: 21 additions & 0 deletions t/t4013/diff.log_--patch-with-stat_--summary_master_--_dir_
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'
---
dir/sub | 3 ---
1 file changed, 3 deletions(-)

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Expand Down
51 changes: 51 additions & 0 deletions t/t4013/diff.log_--patch-with-stat_master
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,57 @@ Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'
---
dir/sub | 3 ---
file0 | 3 ---
file3 | 4 ----
3 files changed, 10 deletions(-)

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0
index fffffff..fffffff 100644
--- a/file0
+++ b/file0
@@ -1,12 +1,9 @@
1
2
3
-<<<<<<< fffffff (Third)
4
5
6
-=======
A
B
C
->>>>>>> fffffff (Side)
diff --git a/file3 b/file3
deleted file mode 100644
index fffffff..0000000
--- a/file3
+++ /dev/null
@@ -1,4 +0,0 @@
-A
-B
-1
-2

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Expand Down
21 changes: 21 additions & 0 deletions t/t4013/diff.log_--patch-with-stat_master_--_dir_
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'
---
dir/sub | 3 ---
1 file changed, 3 deletions(-)

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Expand Down
52 changes: 52 additions & 0 deletions t/t4013/diff.log_--root_--patch-with-stat_--summary_master
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,58 @@ Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'
---
dir/sub | 3 ---
file0 | 3 ---
file3 | 4 ----
3 files changed, 10 deletions(-)
delete mode 100644 file3

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0
index fffffff..fffffff 100644
--- a/file0
+++ b/file0
@@ -1,12 +1,9 @@
1
2
3
-<<<<<<< fffffff (Third)
4
5
6
-=======
A
B
C
->>>>>>> fffffff (Side)
diff --git a/file3 b/file3
deleted file mode 100644
index fffffff..0000000
--- a/file3
+++ /dev/null
@@ -1,4 +0,0 @@
-A
-B
-1
-2

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Expand Down
51 changes: 51 additions & 0 deletions t/t4013/diff.log_--root_--patch-with-stat_master
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,57 @@ Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'
---
dir/sub | 3 ---
file0 | 3 ---
file3 | 4 ----
3 files changed, 10 deletions(-)

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0
index fffffff..fffffff 100644
--- a/file0
+++ b/file0
@@ -1,12 +1,9 @@
1
2
3
-<<<<<<< fffffff (Third)
4
5
6
-=======
A
B
C
->>>>>>> fffffff (Side)
diff --git a/file3 b/file3
deleted file mode 100644
index fffffff..0000000
--- a/file3
+++ /dev/null
@@ -1,4 +0,0 @@
-A
-B
-1
-2

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Expand Down
46 changes: 46 additions & 0 deletions t/t4013/diff.log_--root_-p_master
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,52 @@ Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
index fffffff..fffffff 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,11 +1,8 @@
A
B
-<<<<<<< fffffff (Third)
C
D
E
F
-=======
1
2
->>>>>>> fffffff (Side)
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0
index fffffff..fffffff 100644
--- a/file0
+++ b/file0
@@ -1,12 +1,9 @@
1
2
3
-<<<<<<< fffffff (Third)
4
5
6
-=======
A
B
C
->>>>>>> fffffff (Side)
diff --git a/file3 b/file3
deleted file mode 100644
index fffffff..0000000
--- a/file3
+++ /dev/null
@@ -1,4 +0,0 @@
-A
-B
-1
-2

commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:03:00 2006 +0000
Expand Down
12 changes: 12 additions & 0 deletions t/t4013/diff.log_-GF_-p_--pickaxe-all_master
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
$ git log -GF -p --pickaxe-all master
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0

commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:02:00 2006 +0000
Expand Down
12 changes: 12 additions & 0 deletions t/t4013/diff.log_-GF_-p_master
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
$ git log -GF -p master
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:04:00 2006 +0000

Merge branch 'side'

diff --git a/dir/sub b/dir/sub
remerge CONFLICT (content): Merge conflict in dir/sub
diff --git a/file0 b/file0
remerge CONFLICT (content): Merge conflict in file0

commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <[email protected]>
Date: Mon Jun 26 00:02:00 2006 +0000
Expand Down
Loading

0 comments on commit 55d2018

Please sign in to comment.