ok/jj
1
0
Fork 0
forked from mirrors/jj

diff: fix typo in Git diff "index old..new" header

Spotted while consolidating "index" line generation. Git appears to use ".." to
separate hashes.
This commit is contained in:
Yuya Nishihara 2024-07-14 19:26:07 +09:00
parent 0912c74ecf
commit 07a6a8016c
10 changed files with 37 additions and 37 deletions

View file

@ -1048,12 +1048,12 @@ pub fn show_git_diff(
writeln!(formatter, "old mode {}", &left_part.mode)?;
writeln!(formatter, "new mode {}", &right_part.mode)?;
if left_part.hash != right_part.hash {
writeln!(formatter, "index {}...{}", &left_part.hash, right_part.hash)?;
writeln!(formatter, "index {}..{}", &left_part.hash, right_part.hash)?;
}
} else if left_part.hash != right_part.hash {
writeln!(
formatter,
"index {}...{} {}",
"index {}..{} {}",
&left_part.hash, right_part.hash, left_part.mode
)?;
}

View file

@ -83,7 +83,7 @@ fn test_diff() {
.failure();
insta::assert_snapshot!(get_stdout_string(&assert).replace('\\', "/"), @r###"
diff --git a/a-first b/a-first
index 257cc5642c...5716ca5987 100644
index 257cc5642c..5716ca5987 100644
--- a/a-first
+++ b/a-first
@@ -1,1 +1,1 @@

View file

@ -138,7 +138,7 @@ fn test_concurrent_operations_wc_modified() {
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file b/file
index 12f00e90b6...2e0996000b 100644
index 12f00e90b6..2e0996000b 100644
--- a/file
+++ b/file
@@ -1,1 +1,1 @@

View file

@ -89,7 +89,7 @@ fn test_diff_basic() {
@@ -1,1 +1,0 @@
-foo
diff --git a/file2 b/file2
index 523a4a9de8...485b56a572 100644
index 523a4a9de8..485b56a572 100644
--- a/file2
+++ b/file2
@@ -1,2 +1,3 @@
@ -116,7 +116,7 @@ fn test_diff_basic() {
@@ -1,1 +1,0 @@
-foo
diff --git a/file2 b/file2
index 523a4a9de8...485b56a572 100644
index 523a4a9de8..485b56a572 100644
--- a/file2
+++ b/file2
@@ -2,1 +2,2 @@
@ -142,7 +142,7 @@ fn test_diff_basic() {
<<diff hunk_header::@@ -1,1 +1,0 @@>>
<<diff removed::->><<diff removed token::foo>>
<<diff file_header::diff --git a/file2 b/file2>>
<<diff file_header::index 523a4a9de8...485b56a572 100644>>
<<diff file_header::index 523a4a9de8..485b56a572 100644>>
<<diff file_header::--- a/file2>>
<<diff file_header::+++ b/file2>>
<<diff hunk_header::@@ -1,2 +1,3 @@>>
@ -172,7 +172,7 @@ fn test_diff_basic() {
@@ -1,1 +1,0 @@
-foo
diff --git a/file2 b/file2
index 523a4a9de8...485b56a572 100644
index 523a4a9de8..485b56a572 100644
--- a/file2
+++ b/file2
@@ -1,2 +1,3 @@
@ -362,7 +362,7 @@ fn test_diff_file_mode() {
diff --git a/file1 b/file1
old mode 100755
new mode 100644
index e69de29bb2...0cfbf08886
index e69de29bb2..0cfbf08886
--- a/file1
+++ b/file1
@@ -1,0 +1,1 @@
@ -373,7 +373,7 @@ fn test_diff_file_mode() {
diff --git a/file3 b/file3
old mode 100644
new mode 100755
index d00491fd7e...0cfbf08886
index d00491fd7e..0cfbf08886
--- a/file3
+++ b/file3
@@ -1,1 +1,1 @@
@ -621,28 +621,28 @@ fn test_diff_relative_paths() {
let stdout = test_env.jj_cmd_success(&repo_path.join("dir1"), &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/dir1/file2 b/dir1/file2
index 54b060eee9...1fe912cdd8 100644
index 54b060eee9..1fe912cdd8 100644
--- a/dir1/file2
+++ b/dir1/file2
@@ -1,1 +1,1 @@
-foo2
+bar2
diff --git a/dir1/subdir1/file3 b/dir1/subdir1/file3
index c1ec6c6f12...f3c8b75ec6 100644
index c1ec6c6f12..f3c8b75ec6 100644
--- a/dir1/subdir1/file3
+++ b/dir1/subdir1/file3
@@ -1,1 +1,1 @@
-foo3
+bar3
diff --git a/dir2/file4 b/dir2/file4
index a0016dbc4c...17375f7a12 100644
index a0016dbc4c..17375f7a12 100644
--- a/dir2/file4
+++ b/dir2/file4
@@ -1,1 +1,1 @@
-foo4
+bar4
diff --git a/file1 b/file1
index 1715acd6a5...05c4fe6772 100644
index 1715acd6a5..05c4fe6772 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,1 @@
@ -694,7 +694,7 @@ fn test_diff_missing_newline() {
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file1 b/file1
index 1910281566...a907ec3f43 100644
index 1910281566..a907ec3f43 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@
@ -704,7 +704,7 @@ fn test_diff_missing_newline() {
+bar
\ No newline at end of file
diff --git a/file2 b/file2
index a907ec3f43...1910281566 100644
index a907ec3f43..1910281566 100644
--- a/file2
+++ b/file2
@@ -1,2 +1,1 @@
@ -1077,7 +1077,7 @@ fn test_diff_leading_trailing_context() {
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=5"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file1 b/file1
index 1bf57dee4a...69b3e1865c 100644
index 1bf57dee4a..69b3e1865c 100644
--- a/file1
+++ b/file1
@@ -1,12 +1,12 @@
@ -1101,7 +1101,7 @@ fn test_diff_leading_trailing_context() {
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=3"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file1 b/file1
index 1bf57dee4a...69b3e1865c 100644
index 1bf57dee4a..69b3e1865c 100644
--- a/file1
+++ b/file1
@@ -3,8 +3,8 @@
@ -1121,7 +1121,7 @@ fn test_diff_leading_trailing_context() {
let stdout = test_env.jj_cmd_success(&repo_path, &["diff", "--git", "--context=2"]);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file1 b/file1
index 1bf57dee4a...69b3e1865c 100644
index 1bf57dee4a..69b3e1865c 100644
--- a/file1
+++ b/file1
@@ -4,6 +4,6 @@

View file

@ -498,7 +498,7 @@ fn test_diffedit_old_restore_interactive_tests() {
@@ -1,1 +1,0 @@
-a
diff --git a/file2 b/file2
index 7898192261...6178079822 100644
index 7898192261..6178079822 100644
--- a/file2
+++ b/file2
@@ -1,1 +1,1 @@

View file

@ -101,7 +101,7 @@ fn test_gitignores_ignored_file_in_target_commit() {
);
insta::assert_snapshot!(stdout, @r###"
diff --git a/ignored b/ignored
index 8a69467466...4d9be5127b 100644
index 8a69467466..4d9be5127b 100644
--- a/ignored
+++ b/ignored
@@ -1,1 +1,1 @@

View file

@ -67,7 +67,7 @@ fn test_interdiff_basic() {
);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file2 b/file2
index 257cc5642c...3bd1f0e297 100644
index 257cc5642c..3bd1f0e297 100644
--- a/file2
+++ b/file2
@@ -1,1 +1,2 @@
@ -149,7 +149,7 @@ fn test_interdiff_conflicting() {
);
insta::assert_snapshot!(stdout, @r###"
diff --git a/file b/file
index 0000000000...24c5735c3e 100644
index 0000000000..24c5735c3e 100644
--- a/file
+++ b/file
@@ -1,7 +1,1 @@

View file

@ -114,7 +114,7 @@ fn test_log_with_or_without_diff() {
@ a new commit
M file1
diff --git a/file1 b/file1
index 257cc5642c...3bd1f0e297 100644
index 257cc5642c..3bd1f0e297 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@
@ -176,7 +176,7 @@ fn test_log_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
a new commit
diff --git a/file1 b/file1
index 257cc5642c...3bd1f0e297 100644
index 257cc5642c..3bd1f0e297 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@
@ -241,7 +241,7 @@ fn test_log_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
@ a new commit
diff --git a/file1 b/file1
~ index 257cc5642c...3bd1f0e297 100644
~ index 257cc5642c..3bd1f0e297 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@
@ -255,7 +255,7 @@ fn test_log_with_or_without_diff() {
insta::assert_snapshot!(stdout, @r###"
a new commit
diff --git a/file1 b/file1
index 257cc5642c...3bd1f0e297 100644
index 257cc5642c..3bd1f0e297 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@

View file

@ -107,7 +107,7 @@ fn test_obslog_with_or_without_diff() {
rlvkpnrz test.user@example.com 2001-02-03 08:05:10 66b42ad3
my description
diff --git a/file1 b/file1
index 0000000000...2ab19ae607 100644
index 0000000000..2ab19ae607 100644
--- a/file1
+++ b/file1
@@ -1,7 +1,1 @@
@ -124,7 +124,7 @@ fn test_obslog_with_or_without_diff() {
rlvkpnrz hidden test.user@example.com 2001-02-03 08:05:09 068224a7
my description
diff --git a/file1 b/file1
index 257cc5642c...3bd1f0e297 100644
index 257cc5642c..3bd1f0e297 100644
--- a/file1
+++ b/file1
@@ -1,1 +1,2 @@

View file

@ -100,7 +100,7 @@ fn test_resolution() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/file b/file
index 0000000000...88425ec521 100644
index 0000000000..88425ec521 100644
--- a/file
+++ b/file
@@ -1,7 +1,1 @@
@ -140,7 +140,7 @@ fn test_resolution() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/file b/file
index 0000000000...88425ec521 100644
index 0000000000..88425ec521 100644
--- a/file
+++ b/file
@@ -1,7 +1,1 @@
@ -189,7 +189,7 @@ fn test_resolution() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/file b/file
index 0000000000...88425ec521 100644
index 0000000000..88425ec521 100644
--- a/file
+++ b/file
@@ -1,7 +1,1 @@
@ -324,7 +324,7 @@ fn test_resolution() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/file b/file
index 0000000000...0610716cc1 100644
index 0000000000..0610716cc1 100644
--- a/file
+++ b/file
@@ -1,7 +1,7 @@
@ -879,7 +879,7 @@ fn test_multiple_conflicts() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/another_file b/another_file
index 0000000000...a9fcc7d486 100644
index 0000000000..a9fcc7d486 100644
--- a/another_file
+++ b/another_file
@@ -1,7 +1,1 @@
@ -918,7 +918,7 @@ fn test_multiple_conflicts() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/another_file b/another_file
index 0000000000...7903e1c1c7 100644
index 0000000000..7903e1c1c7 100644
--- a/another_file
+++ b/another_file
@@ -1,7 +1,1 @@
@ -945,7 +945,7 @@ fn test_multiple_conflicts() {
insta::assert_snapshot!(test_env.jj_cmd_success(&repo_path, &["diff", "--git"]),
@r###"
diff --git a/another_file b/another_file
index 0000000000...7903e1c1c7 100644
index 0000000000..7903e1c1c7 100644
--- a/another_file
+++ b/another_file
@@ -1,7 +1,1 @@
@ -958,7 +958,7 @@ fn test_multiple_conflicts() {
->>>>>>> Conflict 1 of 1 ends
+first resolution for auto-chosen file
diff --git a/this_file_has_a_very_long_name_to_test_padding b/this_file_has_a_very_long_name_to_test_padding
index 0000000000...f8c72adf17 100644
index 0000000000..f8c72adf17 100644
--- a/this_file_has_a_very_long_name_to_test_padding
+++ b/this_file_has_a_very_long_name_to_test_padding
@@ -1,7 +1,1 @@