Skip to content

Commit

Permalink
diff: fix typo in Git diff "index old..new" header
Browse files Browse the repository at this point in the history
Spotted while consolidating "index" line generation. Git appears to use ".." to
separate hashes.
  • Loading branch information
yuja committed Jul 14, 2024
1 parent c157c8a commit 49f8071
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions cli/src/diff_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)?;
}
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_acls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_concurrent_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
30 changes: 15 additions & 15 deletions cli/tests/test_diff_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand All @@ -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>>
[1m<<diff file_header::index 523a4a9de8...485b56a572 100644>>[0m
[1m<<diff file_header::index 523a4a9de8..485b56a572 100644>>[0m
<<diff file_header::--- a/file2>>
<<diff file_header::+++ b/file2>>
<<diff hunk_header::@@ -1,2 +1,3 @@>>
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand All @@ -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 @@
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_diffedit_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/test_gitignores.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_interdiff_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down
8 changes: 4 additions & 4 deletions cli/tests/test_log_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand Down
4 changes: 2 additions & 2 deletions cli/tests/test_obslog_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ fn test_obslog_with_or_without_diff() {
rlvkpnrz [email protected] 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 @@
Expand All @@ -124,7 +124,7 @@ fn test_obslog_with_or_without_diff() {
rlvkpnrz hidden [email protected] 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 @@
Expand Down
16 changes: 8 additions & 8 deletions cli/tests/test_resolve_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand Down Expand Up @@ -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 @@
Expand All @@ -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 @@
Expand All @@ -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 @@
Expand Down

0 comments on commit 49f8071

Please sign in to comment.