From 49f8071a09423a19f3ecd4b202be2e37a1426ea2 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 14 Jul 2024 19:26:07 +0900 Subject: [PATCH] diff: fix typo in Git diff "index old..new" header Spotted while consolidating "index" line generation. Git appears to use ".." to separate hashes. --- cli/src/diff_util.rs | 4 ++-- cli/tests/test_acls.rs | 2 +- cli/tests/test_concurrent_operations.rs | 2 +- cli/tests/test_diff_command.rs | 30 ++++++++++++------------- cli/tests/test_diffedit_command.rs | 2 +- cli/tests/test_gitignores.rs | 2 +- cli/tests/test_interdiff_command.rs | 4 ++-- cli/tests/test_log_command.rs | 8 +++---- cli/tests/test_obslog_command.rs | 4 ++-- cli/tests/test_resolve_command.rs | 16 ++++++------- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index ac090d4de8a..e8cd7e817eb 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -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 )?; } diff --git a/cli/tests/test_acls.rs b/cli/tests/test_acls.rs index dc72251c806..a354972c87b 100644 --- a/cli/tests/test_acls.rs +++ b/cli/tests/test_acls.rs @@ -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 @@ diff --git a/cli/tests/test_concurrent_operations.rs b/cli/tests/test_concurrent_operations.rs index 7c0ef77b6e7..1b390b2ec32 100644 --- a/cli/tests/test_concurrent_operations.rs +++ b/cli/tests/test_concurrent_operations.rs @@ -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 @@ diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index e508c67ca23..ac9d03bf368 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -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() { <> <><> <> - <> + <> <> <> <> @@ -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 @@ diff --git a/cli/tests/test_diffedit_command.rs b/cli/tests/test_diffedit_command.rs index 14690018021..b9e8618ffcc 100644 --- a/cli/tests/test_diffedit_command.rs +++ b/cli/tests/test_diffedit_command.rs @@ -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 @@ diff --git a/cli/tests/test_gitignores.rs b/cli/tests/test_gitignores.rs index 86fb945df8e..20be005618a 100644 --- a/cli/tests/test_gitignores.rs +++ b/cli/tests/test_gitignores.rs @@ -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 @@ diff --git a/cli/tests/test_interdiff_command.rs b/cli/tests/test_interdiff_command.rs index fe25c65440a..d5995af7e34 100644 --- a/cli/tests/test_interdiff_command.rs +++ b/cli/tests/test_interdiff_command.rs @@ -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 @@ diff --git a/cli/tests/test_log_command.rs b/cli/tests/test_log_command.rs index ad3785671cf..0c4d47c0cef 100644 --- a/cli/tests/test_log_command.rs +++ b/cli/tests/test_log_command.rs @@ -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 @@ diff --git a/cli/tests/test_obslog_command.rs b/cli/tests/test_obslog_command.rs index 81128913440..73579befe39 100644 --- a/cli/tests/test_obslog_command.rs +++ b/cli/tests/test_obslog_command.rs @@ -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 @@ diff --git a/cli/tests/test_resolve_command.rs b/cli/tests/test_resolve_command.rs index 942f9622e2a..fade8d523b2 100644 --- a/cli/tests/test_resolve_command.rs +++ b/cli/tests/test_resolve_command.rs @@ -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 @@